Class ByteContent

java.lang.Object
gov.usgs.earthquake.product.AbstractContent
gov.usgs.earthquake.product.ByteContent
All Implemented Interfaces:
Content

public class ByteContent extends AbstractContent
Content stored in a byte array.
  • Constructor Details

    • ByteContent

      public ByteContent(byte[] content)
      Default constructor accepts a byte array.
      Parameters:
      content - the actual content. This should not be null.
    • ByteContent

      public ByteContent(Content content) throws IOException
      Convert any Content into ByteContent. Any content is read from the InputStream into a new underlying byte array.
      Parameters:
      content - existing content to read.
      Throws:
      IOException - when errors occur reading content.
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: Content
      The content bytes as a stream.
      Returns:
      a ByteArrayInputStream for the wrapped content.
      Throws:
      IOException - if an error occurs while creating the stream.
    • getByteArray

      public byte[] getByteArray()
      Returns:
      the wrapped byte array.
    • close

      public void close()
      Free any resources associated with this content.