Class StreamUtil
java.lang.Object
org.opengis.cite.gmljpx20.util.jp2.StreamUtil
StreamUtil class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intReads 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 longReads 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 shortReads a 2-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by two bytes.static longReads a 4-byte unsigned integer from the current stream using big-endian encoding and advances the position of the stream by four bytes.static longReads 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.
-
Constructor Details
-
StreamUtil
public StreamUtil()
-
-
Method Details
-
readBytes
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
readToEnd.
- Parameters:
s- aInputStreamobject- Returns:
- an array of
byteobjects - Throws:
IOException- if any.
-
readBInt32
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
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
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
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
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.
-