Package gov.nih.mipav.model.file
Class MetadataExtractor.StreamReader
java.lang.Object
gov.nih.mipav.model.file.MetadataExtractor.SequentialReader
gov.nih.mipav.model.file.MetadataExtractor.StreamReader
- Enclosing class:
MetadataExtractor
- Author:
- Drew Noakes https://drewnoakes.com
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns an estimate of the number of bytes that can be read (or skipped over) from thisMetadataExtractor.SequentialReaderwithout blocking by the next invocation of a method for this input stream.bytegetByte()Gets the next byte in the sequence.voidgetBytes(byte[] buffer, int offset, int count) Retrieves bytes, writing them into a caller-provided buffer.byte[]getBytes(int count) Returns the required number of bytes from the sequence.longvoidskip(long n) Skips forward in the sequence.private longskipInternal(long n) booleantrySkip(long n) Skips forward in the sequence, returning a boolean indicating whether the skip succeeded, or whether the sequence ended.Methods inherited from class gov.nih.mipav.model.file.MetadataExtractor.SequentialReader
getDouble64, getFloat32, getInt16, getInt32, getInt64, getInt8, getNullTerminatedBytes, getNullTerminatedString, getNullTerminatedStringValue, getS15Fixed16, getString, getString, getString, getStringValue, getUInt16, getUInt32, getUInt8, isMotorolaByteOrder, setMotorolaByteOrder
-
Field Details
-
_stream
-
_pos
private long _pos
-
-
Constructor Details
-
StreamReader
-
-
Method Details
-
getPosition
public long getPosition()- Specified by:
getPositionin classMetadataExtractor.SequentialReader
-
getByte
Description copied from class:MetadataExtractor.SequentialReaderGets the next byte in the sequence.- Specified by:
getBytein classMetadataExtractor.SequentialReader- Returns:
- The read byte value
- Throws:
IOException
-
getBytes
Description copied from class:MetadataExtractor.SequentialReaderReturns the required number of bytes from the sequence.- Specified by:
getBytesin classMetadataExtractor.SequentialReader- Parameters:
count- The number of bytes to be returned- Returns:
- The requested bytes
- Throws:
IOException
-
getBytes
Description copied from class:MetadataExtractor.SequentialReaderRetrieves bytes, writing them into a caller-provided buffer.- Specified by:
getBytesin classMetadataExtractor.SequentialReader- Parameters:
buffer- The array to write bytes to.offset- The starting position within buffer to write to.count- The number of bytes to be written.- Throws:
IOException
-
skip
Description copied from class:MetadataExtractor.SequentialReaderSkips forward in the sequence. If the sequence ends, anEOFExceptionis thrown.- Specified by:
skipin classMetadataExtractor.SequentialReader- Parameters:
n- the number of byte to skip. Must be zero or greater.- Throws:
IOException- an error occurred reading from the underlying source.
-
trySkip
Description copied from class:MetadataExtractor.SequentialReaderSkips forward in the sequence, returning a boolean indicating whether the skip succeeded, or whether the sequence ended.- Specified by:
trySkipin classMetadataExtractor.SequentialReader- Parameters:
n- the number of byte to skip. Must be zero or greater.- Returns:
- a boolean indicating whether the skip succeeded, or whether the sequence ended.
- Throws:
IOException- an error occurred reading from the underlying source.
-
available
public int available()Description copied from class:MetadataExtractor.SequentialReaderReturns an estimate of the number of bytes that can be read (or skipped over) from thisMetadataExtractor.SequentialReaderwithout blocking by the next invocation of a method for this input stream. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.Note that while some implementations of
MetadataExtractor.SequentialReaderlikeMetadataExtractor.SequentialByteArrayReaderwill return the total remaining number of bytes in the stream, others will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.- Specified by:
availablein classMetadataExtractor.SequentialReader- Returns:
- an estimate of the number of bytes that can be read (or skipped
over) from this
MetadataExtractor.SequentialReaderwithout blocking or0when it reaches the end of the input stream.
-
skipInternal
- Throws:
IOException
-