Class FileUploadable

  • All Implemented Interfaces:
    Uploadable<java.io.File>

    public class FileUploadable
    extends java.lang.Object
    implements Uploadable<java.io.File>
    File uploadable.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.File file  
      protected java.lang.String fileName  
      protected java.lang.String mimeType  
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUploadable​(java.io.File file)  
      FileUploadable​(java.io.File file, java.lang.String fileName, java.lang.String mimeType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBytes()
      Returns content bytes.
      java.io.File getContent()
      Returns the original content.
      java.lang.String getFileName()
      Returns content file name.
      java.lang.String getMimeType()
      Returns MIME type.
      int getSize()
      Returns size in bytes.
      java.io.InputStream openInputStream()
      Opens InputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • file

        protected final java.io.File file
      • fileName

        protected final java.lang.String fileName
      • mimeType

        protected final java.lang.String mimeType
    • Constructor Detail

      • FileUploadable

        public FileUploadable​(java.io.File file)
      • FileUploadable

        public FileUploadable​(java.io.File file,
                              java.lang.String fileName,
                              java.lang.String mimeType)
    • Method Detail

      • getContent

        public java.io.File getContent()
        Description copied from interface: Uploadable
        Returns the original content.
        Specified by:
        getContent in interface Uploadable<java.io.File>
      • getBytes

        public byte[] getBytes()
        Description copied from interface: Uploadable
        Returns content bytes.
        Specified by:
        getBytes in interface Uploadable<java.io.File>
      • getFileName

        public java.lang.String getFileName()
        Description copied from interface: Uploadable
        Returns content file name. If null, the field's name will be used.
        Specified by:
        getFileName in interface Uploadable<java.io.File>
      • getMimeType

        public java.lang.String getMimeType()
        Description copied from interface: Uploadable
        Returns MIME type. If null, MIME type will be determined from file name's extension.
        Specified by:
        getMimeType in interface Uploadable<java.io.File>
      • getSize

        public int getSize()
        Description copied from interface: Uploadable
        Returns size in bytes.
        Specified by:
        getSize in interface Uploadable<java.io.File>
      • openInputStream

        public java.io.InputStream openInputStream()
                                            throws java.io.IOException
        Description copied from interface: Uploadable
        Opens InputStream. User is responsible for closing it.
        Specified by:
        openInputStream in interface Uploadable<java.io.File>
        Throws:
        java.io.IOException