Class FileHandler


  • public final class FileHandler
    extends Object
    A handler for files
    • Constructor Detail

      • FileHandler

        public FileHandler​(byte[] data)
        Creates a FileHandler with given file data as byte array.
        Parameters:
        data - the file as byte array, not null
    • Method Detail

      • asFile

        public File asFile​(String fileName)
        Writes the file data in the specified file and returns the final File.
        Parameters:
        fileName - the given file name, not null
        Returns:
        the final File, not null
      • asInputStream

        public InputStream asInputStream()
        Wraps the file data in a InputStream and returns it.
        Returns:
        the InputStream that 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