Module hw06

Interface IFileContents

All Superinterfaces:
Serializable
All Known Implementing Classes:
FileContents

public interface IFileContents extends Serializable
A Serializable container for the byte stream of a file. Used to transmit a file's contents across the network and then be used as if the file were read from the disk in the form of an java.io.InputStream.
Author:
swong
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The internally stored raw byte stream
    Returns any additional information about the file contents.
    Create an InputStream that sources the file contents.
    A name associated with the file, e.g.
  • Method Details

    • getName

      String getName()
      A name associated with the file, e.g. its filename without the rest of its path. This name is just for reference/identification purposes.
      Returns:
      A name to be associated with the contents.
    • getInfo

      String getInfo()
      Returns any additional information about the file contents. A typical usage would for an image file, for the info to be "jpg" or "png" to tell what kind of image data was in the contents.
      Returns:
      The stored info string.
    • getBytes

      byte[] getBytes()
      The internally stored raw byte stream
      Returns:
      The byte stream of the file
    • getInputStream

      InputStream getInputStream()
      Create an InputStream that sources the file contents. The use of this stream simulates the reading of the file from the disk but without actually involving any such storage access. This feature would be used by the receiver of this object to load the file contents into something that normally wants to read that data from the disk.
      Returns:
      An InputStream