Example #1
0
 private byte[] fileGet(String urlString) {
   try {
     return DSSUtils.toByteArray(new URL(urlString).openStream());
   } catch (IOException e) {
     LOG.warn(e.toString(), e);
   }
   return null;
 }
Example #2
0
  protected byte[] getContent(final HttpEntity responseEntity) throws DSSException {

    try {

      final InputStream content = responseEntity.getContent();
      final byte[] bytes = DSSUtils.toByteArray(content);
      content.close();
      return bytes;
    } catch (IOException e) {
      throw new DSSException(e);
    }
  }
Example #3
0
  /**
   * This method retrieves data using FTP protocol .
   *
   * @param urlString
   * @return
   */
  protected byte[] ftpGet(final String urlString) {

    InputStream inputStream = null;
    try {

      final URL url = new URL(urlString);
      inputStream = url.openStream();
      return DSSUtils.toByteArray(inputStream);
    } catch (Exception e) {

      LOG.warn(e.getMessage());
    } finally {
      DSSUtils.closeQuietly(inputStream);
    }
    return null;
  }
Example #4
0
 /**
  * Creates dss document that retains the data in memory
  *
  * @param inputStream input stream representing the document
  * @throws DSSException
  */
 public InMemoryDocument(final InputStream inputStream) throws DSSException {
   this(DSSUtils.toByteArray(inputStream), null, null);
 }
Example #5
0
 /**
  * Creates dss document that retains the data in memory
  *
  * @param inputStream input stream representing the document
  * @param name the file name if the data originates from a file
  * @param mimeType the mime type of the file if the data originates from a file
  * @throws IOException
  */
 public InMemoryDocument(final InputStream inputStream, final String name, final MimeType mimeType)
     throws DSSException {
   this(DSSUtils.toByteArray(inputStream), name, mimeType);
 }