org.apache.fontbox.cff

## Interface DataInput

All Known Implementing Classes:
  DataInputByteArray, DataInputRandomAccessRead

    public interface DataInput

This interface defines some functionality to read a CFF font.

Author:
  Villu Ruusmann

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`int` `getPosition()` Returns the current position.
`boolean` `hasRemaining()` Determines if there are any bytes left to read or not.
`int` `length()`
`int` `peekUnsignedByte(int offset)` Peeks one single unsigned byte from the buffer.
`byte` `readByte()` Read one single byte from the buffer.
`byte[]` `readBytes(int length)` Read a number of single byte values from the buffer.
`default int` `readInt()` Read one single int (4 bytes) from the buffer.
`default int` `readOffset(int offSize)` Read the offset from the buffer.
`default short` `readShort()` Read one single short value from the buffer.
`int` `readUnsignedByte()` Read one single unsigned byte from the buffer.
`default int` `readUnsignedShort()` Read one single unsigned short (2 bytes) value from the buffer.
`void` `setPosition(int position)` Sets the current position to the given value.

### Method Detail

#### hasRemaining

    boolean hasRemaining()
                  throws IOException

Determines if there are any bytes left to read or not.

Returns:
  true if there are any bytes left to read
Throws:
  `IOException` - if an error occurs during reading

#### getPosition

    int getPosition()
             throws IOException

Returns the current position.

Returns:
  current position
Throws:
  `IOException` - if an error occurs during reading

#### setPosition

    void setPosition(int position)
              throws IOException

Sets the current position to the given value.

Parameters:
  `position` - the given position
Throws:
  `IOException` - if the new position ist out of range

#### readByte

    byte readByte()
           throws IOException

Read one single byte from the buffer.

Returns:
  the byte
Throws:
  `IOException` - if an error occurs during reading

#### readUnsignedByte

    int readUnsignedByte()
                  throws IOException

Read one single unsigned byte from the buffer.

Returns:
  the unsigned byte as int
Throws:
  `IOException` - if an error occurs during reading

#### peekUnsignedByte

    int peekUnsignedByte(int offset)
                  throws IOException

Peeks one single unsigned byte from the buffer.

Parameters:
  `offset` - offset to the byte to be peeked
Returns:
  the unsigned byte as int
Throws:
  `IOException` - if an error occurs during reading

#### readShort

    default short readShort()
                     throws IOException

Read one single short value from the buffer.

Returns:
  the short value
Throws:
  `IOException` - if an error occurs during reading

#### readUnsignedShort

    default int readUnsignedShort()
                           throws IOException

Read one single unsigned short (2 bytes) value from the buffer.

Returns:
  the unsigned short value as int
Throws:
  `IOException` - if an error occurs during reading

#### readInt

    default int readInt()
                 throws IOException

Read one single int (4 bytes) from the buffer.

Returns:
  the int value
Throws:
  `IOException` - if an error occurs during reading

#### readBytes

    byte[] readBytes(int length)
              throws IOException

Read a number of single byte values from the buffer.

Parameters:
  `length` - the number of bytes to be read
Returns:
  an array with containing the bytes from the buffer
Throws:
  `IOException` - if an error occurs during reading

#### length

    int length()
        throws IOException

Throws:
  `IOException`

#### readOffset

    default int readOffset(int offSize)
                    throws IOException

Read the offset from the buffer.

Parameters:
  `offSize` - the given offsize
Returns:
  the offset
Throws:
  `IOException` - if an error occurs during reading