Class FileHolder

  • All Implemented Interfaces:
    Serializable

    public class FileHolder
    extends Object
    implements Serializable
    This is an abstraction of a file which allows this construct to hold a File OR a Stream
    Author:
    Aaron Zeckoski (azeckoski @ vt.edu)
    See Also:
    Serialized Form
    • Constructor Detail

      • FileHolder

        public FileHolder​(File file)
        Create a KF from a File object
        Parameters:
        file - the file (must not be null)
      • FileHolder

        public FileHolder​(FileInputStream fileInputStream,
                          String mimeType,
                          String name)
        Create a KF from a FileInputStream object
        Parameters:
        fileInputStream - the file stream (must not be null)
        mimeType - mime type
        name - the file name
      • FileHolder

        public FileHolder​(InputStream inputStream,
                          String mimeType,
                          String name,
                          long size)
        Create a KF from a normal input stream and some params
        Parameters:
        inputStream - the file content stream (must not be null)
        mimeType - mime type
        name - the file name
        size - the file size
    • Method Detail

      • getName

        public String getName()
        Returns:
        the name for the file (is NEVER null)
      • getFile

        public File getFile()
        Returns:
        the File object if one is set (this can be null)
      • getSize

        public long getSize()
        Returns:
        the size of this file
      • getMimeType

        public String getMimeType()
        Returns:
        the mime-type this file
      • getInputStream

        public InputStream getInputStream()
        Returns:
        the input stream for this File (this is NEVER null)