Class DefaultSerializableFile

    • Method Detail

      • fileSize

        public long fileSize()
        Description copied from interface: ISerializableFile
        Gets the size of the file in bytes.
        Specified by:
        fileSize in interface ISerializableFile
        Returns:
        The size of the file in bytes.
      • emptySerializableFile

        public static ISerializableFile emptySerializableFile​(String fileName,
                                                              String contentType)
        Creates an empty serializable file with the given file name and content type.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        Returns:
        An empty serializable file with the given file name and content type.
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         File data)
        Creates a serializable file with the given file name, content type and data.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        data - The data of the file.
        Returns:
        A serializable file with the given file name, content type and data.
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         Path data)
                                                  throws IOException
        Creates a serializable file with the given file name, content type and data.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        data - The data of the file.
        Returns:
        A serializable file with the given file name, content type and data.
        Throws:
        IOException
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         byte[] data)
        Creates a serializable file with the given file name, content type and data.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        data - The data of the file.
        Returns:
        A serializable file with the given file name, content type and data.
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         String textData,
                                                         Charset charset)
        Creates a serializable file with the given file name, content type and data.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        textData - The text data of the file.
        charset - The charset of the text data.
        Returns:
        A serializable file with the given file name, content type and data.
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         long fileSize,
                                                         ISerializableInputStreamSupplier data)
        Creates a serializable file with the given file name, content type and data.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        fileSize - The size of the file in bytes.
        data - The data of the file.
        Returns:
        A serializable file with the given file name, content type and data.
      • serializableFile

        public static ISerializableFile serializableFile​(String fileName,
                                                         String contentType,
                                                         InputStream data)
                                                  throws IOException
        Creates a serializable file with the given file name, content type and data. Note that since the instance must be serializable, the data from the input stream will be read into memory.
        Parameters:
        fileName - The name of the file.
        contentType - The content type of the file.
        data - The data of the file.
        Returns:
        A serializable file with the given file name, content type and data.
        Throws:
        IOException