Class FileHandle


  • public class FileHandle
    extends java.lang.Object
    Simple handle class for providing lightweight access to files. Refers to file content via an InputStream rather than ever needing to refer to the entire content at once Written with the intention for use within functionality that unzips files over FileTransfer protocols whereby we do not want to hold the entire file itself in memory at any given time, rather a handle to an IO stream
    Author:
    Ikasan Development Team
    • Constructor Summary

      Constructors 
      Constructor Description
      FileHandle​(java.lang.String path, java.io.ByteArrayInputStream byteArrayInputStream)
      Constructor
      FileHandle​(java.lang.String path, java.io.InputStream inputStream, boolean isDirectory)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getContentAsInputStream()
      Returns the content by way of an InputStream Note that as with all InputStreams, once read, there is no way to rewind.
      java.lang.String getPath()
      Returns the path of the file as a String
      boolean isDirectory()
      Accessor for isDirectory flag
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FileHandle

        public FileHandle​(java.lang.String path,
                          java.io.InputStream inputStream,
                          boolean isDirectory)
        Constructor
        Parameters:
        path -
        inputStream -
        isDirectory -
      • FileHandle

        public FileHandle​(java.lang.String path,
                          java.io.ByteArrayInputStream byteArrayInputStream)
        Constructor
        Parameters:
        path -
        byteArrayInputStream -
    • Method Detail

      • getPath

        public java.lang.String getPath()
        Returns the path of the file as a String
        Returns:
        String
      • getContentAsInputStream

        public java.io.InputStream getContentAsInputStream()
        Returns the content by way of an InputStream Note that as with all InputStreams, once read, there is no way to rewind. A new instance of the handle would be required.
        Returns:
        InputStream
      • isDirectory

        public boolean isDirectory()
        Accessor for isDirectory flag
        Returns:
        isDirectory
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()