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`

public class DataBufferedInputStream extends FilterInputStream implements DataInput
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

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_BUFFER_SIZE`
Default buffer size 8192, same as java.io.BufferedInputStream.

### Fields inherited from class java.io.FilterInputStream

`in`

## Constructor Summary

Constructors
Constructor
Description
`DataBufferedInputStream(InputStream in)`
Constructs an instance with a default buffer size.
`DataBufferedInputStream(InputStream in, int size)`
Constructs an instance with a given buffer size.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`mark(int limit)`
`boolean`
`markSupported()`
Returns false;
`int`
`read()`
`int`
`read(byte[] b)`
`int`
`read(byte[] b, int off, int len)`
`boolean`
`readBoolean()`
`byte`
`readByte()`
`char`
`readChar()`
`double`
`readDouble()`
`float`
`readFloat()`
`void`
`readFully(byte[] b)`
`void`
`readFully(byte[] b, int off, int len)`
`int`
`readInt()`
`String`
`readLine()`
Deprecated.
`long`
`readLong()`
`short`
`readShort()`
`int`
`readUnsignedByte()`
`int`
`readUnsignedShort()`
`String`
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Default buffer size 8192, same as java.io.BufferedInputStream.

See Also:
  - Constant Field Values

## Constructor Details

### DataBufferedInputStream

public DataBufferedInputStream(InputStream in)
Constructs an instance with a default buffer size.

Parameters:
  `in` - base input stream

### DataBufferedInputStream

public DataBufferedInputStream(InputStream in, int size)
Constructs an instance with a given buffer size.

Parameters:
  `in` - base input stream
  `size` - buffer length in bytes

## Method Details

### read

public int read() throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read(byte[] b, int off, int len) throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read(byte[] b) throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws IOException

Overrides:
  `skip` in class `FilterInputStream`
Throws:
  `IOException`

### available

public int available() throws IOException

Overrides:
  `available` in class `FilterInputStream`
Throws:
  `IOException`

### markSupported

public boolean markSupported()
Returns false;

Overrides:
  `markSupported` in class `FilterInputStream`

### mark

public void mark(int limit)

Overrides:
  `mark` in class `FilterInputStream`

### reset

public void reset() throws IOException

Overrides:
  `reset` in class `FilterInputStream`
Throws:
  `IOException`

### readBoolean

public boolean readBoolean() throws IOException

Specified by:
  `readBoolean` in interface `DataInput`
Throws:
  `IOException`

### readByte

public byte readByte() throws IOException

Specified by:
  `readByte` in interface `DataInput`
Throws:
  `IOException`

### readUnsignedByte

public int readUnsignedByte() throws IOException

Specified by:
  `readUnsignedByte` in interface `DataInput`
Throws:
  `IOException`

### readShort

public short readShort() throws IOException

Specified by:
  `readShort` in interface `DataInput`
Throws:
  `IOException`

### readUnsignedShort

public int readUnsignedShort() throws IOException

Specified by:
  `readUnsignedShort` in interface `DataInput`
Throws:
  `IOException`

### readChar

public char readChar() throws IOException

Specified by:
  `readChar` in interface `DataInput`
Throws:
  `IOException`

### readInt

public int readInt() throws IOException

Specified by:
  `readInt` in interface `DataInput`
Throws:
  `IOException`

### readLong

public long readLong() throws IOException

Specified by:
  `readLong` in interface `DataInput`
Throws:
  `IOException`

### readFloat

public float readFloat() throws IOException

Specified by:
  `readFloat` in interface `DataInput`
Throws:
  `IOException`

### readDouble

public double readDouble() throws IOException

Specified by:
  `readDouble` in interface `DataInput`
Throws:
  `IOException`

### readFully

public void readFully(byte[] b) throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

### readFully

public void readFully(byte[] b, int off, int len) throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

### readLine

@Deprecated public String readLine() throws IOException
Deprecated.
This method is deprecated and unsupported.

Specified by:
  `readLine` in interface `DataInput`
Throws:
  `UnsupportedOperationException` - always
  `IOException`

### readUTF

public String readUTF() throws IOException

Specified by:
  `readUTF` in interface `DataInput`
Throws:
  `IOException`

### skipBytes

public int skipBytes(int n) throws IOException

Specified by:
  `skipBytes` in interface `DataInput`
Throws:
  `IOException`