Package org.jnbis.api.handler
Class FileHandler
- java.lang.Object
-
- org.jnbis.api.handler.FileHandler
-
public final class FileHandler extends Object
A handler for files
-
-
Constructor Summary
Constructors Constructor Description FileHandler(byte[] data)Creates aFileHandlerwith given file data as byte array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asByteArray()Returns the file data as byte array.FileasFile(String fileName)Writes the file data in the specified file and returns the finalFile.InputStreamasInputStream()Wraps the file data in aInputStreamand returns it.
-
-
-
Method Detail
-
asFile
public File asFile(String fileName)
Writes the file data in the specified file and returns the finalFile.- Parameters:
fileName- the given file name, not null- Returns:
- the final File, not null
-
asInputStream
public InputStream asInputStream()
Wraps the file data in aInputStreamand returns it.- Returns:
- the
InputStreamthat is created with the file data, not null
-
asByteArray
public byte[] asByteArray()
Returns the file data as byte array.- Returns:
- byte array that contains the file data, not null
-
-