Class FileHandle
- java.lang.Object
-
- org.ikasan.connector.basefiletransfer.outbound.command.util.FileHandle
-
public class FileHandle extends java.lang.ObjectSimple handle class for providing lightweight access to files. Refers to file content via anInputStreamrather 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)ConstructorFileHandle(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.InputStreamgetContentAsInputStream()Returns the content by way of an InputStream Note that as with allInputStreams, once read, there is no way to rewind.java.lang.StringgetPath()Returns the path of the file as a StringbooleanisDirectory()Accessor for isDirectory flagjava.lang.StringtoString()
-
-
-
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 allInputStreams, 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:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-