Class BufferedMagicNumberStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.arakhne.afc.inputoutput.filetype.BufferedMagicNumberStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
final class BufferedMagicNumberStream extends FilterInputStream
This class defines is a buffered input stream which provides additional reading functions which hare very useful for aMagicNumberStream
.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:40
- Author:
- Stéphane GALLAND
- See Also:
MagicNumberStream
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- inputoutput
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description BufferedMagicNumberStream(InputStream is)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getStream()
Replies the stream buffered by this object.int
read()
byte
read(int offset)
Replies a byte at the specified offset.byte[]
read(int offset, int length)
Replies the bytes at the specified offset.byte[]
readLine(int offset)
Replies the bytes until the next end of the first line (inclusive).-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
BufferedMagicNumberStream
BufferedMagicNumberStream(InputStream is)
Constructor.- Parameters:
is
- is the input stream.
-
-
Method Detail
-
getStream
public InputStream getStream()
Replies the stream buffered by this object. This buffered stream is the stream pass as parameter of the constructor.- Returns:
- the buffered stream.
-
read
public byte[] read(int offset, int length) throws IOException
Replies the bytes at the specified offset.- Parameters:
offset
- is the position of the first byte to read.length
- is the count of bytes to read.- Returns:
- the array of red bytes.
- Throws:
IOException
- in case of problems
-
read
public byte read(int offset) throws IOException
Replies a byte at the specified offset.- Parameters:
offset
- is the position of the byte to read.- Returns:
- the byte.
- Throws:
IOException
- in case of problems
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
readLine
public byte[] readLine(int offset) throws IOException
Replies the bytes until the next end of the first line (inclusive).- Parameters:
offset
- is the position of the byte to read.- Returns:
- the bytes; or
null
if EOF - Throws:
IOException
- in case of problems
-
-