Package uk.ac.starlink.util
Class DataBufferedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
uk.ac.starlink.util.DataBufferedInputStream
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
InputStream which provides buffering and an efficient DataInput
implementation.
It can be much more efficient than layering a DataInputStream on top of
a BufferedInputStream.
- Since:
- 1 Mar 2022
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default buffer size 8192, same as java.io.BufferedInputStream.Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance with a default buffer size.DataBufferedInputStream
(InputStream in, int size) Constructs an instance with a given buffer size. -
Method Summary
Modifier and TypeMethodDescriptionint
void
mark
(int limit) boolean
Returns false;int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) boolean
byte
readByte()
char
readChar()
double
float
void
readFully
(byte[] b) void
readFully
(byte[] b, int off, int len) int
readInt()
readLine()
Deprecated.long
readLong()
short
int
int
readUTF()
void
reset()
long
skip
(long n) int
skipBytes
(int n) Methods inherited from class java.io.FilterInputStream
close
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZEDefault buffer size 8192, same as java.io.BufferedInputStream.- See Also:
-
-
Constructor Details
-
DataBufferedInputStream
Constructs an instance with a default buffer size.- Parameters:
in
- base input stream
-
DataBufferedInputStream
Constructs an instance with a given buffer size.- Parameters:
in
- base input streamsize
- buffer length in bytes
-
-
Method Details
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()Returns false;- Overrides:
markSupported
in classFilterInputStream
-
mark
public void mark(int limit) - Overrides:
mark
in classFilterInputStream
-
reset
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
readBoolean
- Specified by:
readBoolean
in interfaceDataInput
- Throws:
IOException
-
readByte
- Specified by:
readByte
in interfaceDataInput
- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedByte
in interfaceDataInput
- Throws:
IOException
-
readShort
- Specified by:
readShort
in interfaceDataInput
- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShort
in interfaceDataInput
- Throws:
IOException
-
readChar
- Specified by:
readChar
in interfaceDataInput
- Throws:
IOException
-
readInt
- Specified by:
readInt
in interfaceDataInput
- Throws:
IOException
-
readLong
- Specified by:
readLong
in interfaceDataInput
- Throws:
IOException
-
readFloat
- Specified by:
readFloat
in interfaceDataInput
- Throws:
IOException
-
readDouble
- Specified by:
readDouble
in interfaceDataInput
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readLine
Deprecated.This method is deprecated and unsupported.- Specified by:
readLine
in interfaceDataInput
- Throws:
UnsupportedOperationException
- alwaysIOException
-
readUTF
- Specified by:
readUTF
in interfaceDataInput
- Throws:
IOException
-
skipBytes
- Specified by:
skipBytes
in interfaceDataInput
- Throws:
IOException
-