Class StreamUtil

java.lang.Object
org.opengis.cite.gmljpx20.util.jp2.StreamUtil

public class StreamUtil extends Object

StreamUtil class.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Reads a 4-byte signed integer from the current stream using big-endian encoding and advances the current position of the stream by four bytes.
    static long
    Reads an 8-byte signed integer from the current stream using big-endian encoding and advances the current position of the stream by eight bytes.
    static short
    Reads a 2-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by two bytes.
    static long
    Reads a 4-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by four bytes.
    static long
    Reads an 8-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by eight bytes.
    static byte[]
    readBytes(InputStream s, int count)
    Reads count bytes from the current stream into a byte array and advances the current position by count bytes.
    static byte[]
    readToEnd.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StreamUtil

      public StreamUtil()
  • Method Details

    • readBytes

      public static byte[] readBytes(InputStream s, int count) throws IOException
      Reads count bytes from the current stream into a byte array and advances the current position by count bytes.
      Parameters:
      s - The stream to read.
      count - The number of bytes to read.
      Returns:
      A byte array containing data read from the underlying stream. This might be less than the number of bytes requested if the end of the stream is reached.
      Throws:
      IOException - An I/O error occurs. // @throws ObjectDisposedException The stream is closed. // @throws ArgumentOutOfRangeException count is negative.
    • readToEnd

      public static byte[] readToEnd(InputStream s) throws IOException

      readToEnd.

      Parameters:
      s - a InputStream object
      Returns:
      an array of byte objects
      Throws:
      IOException - if any.
    • readBInt32

      public static int readBInt32(InputStream s) throws Exception
      Reads a 4-byte signed integer from the current stream using big-endian encoding and advances the current position of the stream by four bytes.
      Parameters:
      s - The stream to read.
      Returns:
      A 4-byte signed integer read from the current stream. // @throws EndOfStreamException The end of the stream is reached. // @throws ObjectDisposedException The stream is closed.
      Throws:
      Exception - if any.
    • readBInt64

      public static long readBInt64(InputStream s) throws Exception
      Reads an 8-byte signed integer from the current stream using big-endian encoding and advances the current position of the stream by eight bytes.
      Parameters:
      s - The stream to read.
      Returns:
      An 8-byte signed integer read from the current stream.
      Throws:
      Exception - //@throws EndOfStreamjava.lang.Exception The end of the stream is reached. //@throws ObjectDisposedjava.lang.Exception The stream is closed.
    • readBUInt16

      public static short readBUInt16(InputStream s) throws Exception
      Reads a 2-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by two bytes.
      Parameters:
      s - The stream to read.
      Returns:
      A 2-byte unsigned integer read from this stream.
      Throws:
      Exception - //@throws EndOfStreamjava.lang.Exception The end of the stream is reached. //@throws ObjectDisposedjava.lang.Exception The stream is closed.
    • readBUInt32

      public static long readBUInt32(InputStream s) throws Exception
      Reads a 4-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by four bytes.
      Parameters:
      s - The stream to read.
      Returns:
      A 4-byte unsigned integer read from this stream.
      Throws:
      Exception - //@throws EndOfStreamjava.lang.Exception The end of the stream is reached. //@throws ObjectDisposedjava.lang.Exception The stream is closed.
    • readBUInt64

      public static long readBUInt64(InputStream s) throws Exception
      Reads an 8-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by eight bytes.
      Parameters:
      s - The stream to read.
      Returns:
      An 8-byte unsigned integer read from this stream.
      Throws:
      Exception - //@throws EndOfStreamjava.lang.Exception The end of the stream is reached. //@throws ObjectDisposedjava.lang.Exception The stream is closed.