jdbm.recman

## Class BlockIo

- java.lang.Object
- - jdbm.recman.BlockIo

All Implemented Interfaces:
  Externalizable, Serializable

    public final class BlockIo
    extends Object
    implements Externalizable

This class wraps a page-sized byte array and provides methods to read and write data to and from it. The readers and writers are just the ones that the rest of the toolkit needs, nothing else. Values written are compatible with java.io routines. This block is never accessed directly, so it does not have to be thread-safe.

See Also:
  `DataInput`, `DataOutput`, Serialized Form

### Field Summary

Fields
`static long` `serialVersionUID`

### Constructor Summary

Constructors
Constructor and Description
`BlockIo()` Default constructor for serialization

### Method Summary

Methods
`BlockView` `getView()`
`byte` `readByte(int pos)` Reads a byte from the indicated position
`void` `readExternal(ObjectInput in)` implement externalizable interface
`int` `readInt(int pos)` Reads an int from the indicated position
`long` `readLong(int pos)` Reads a long from the indicated position
`short` `readShort(int pos)` Reads a short from the indicated position
`void` `setView(BlockView view)` Sets the current view of the block.
`String` `toString()`
`void` `writeByte(int pos, byte value)` Writes a byte to the indicated position
`void` `writeExternal(ObjectOutput out)` implement externalizable interface
`void` `writeInt(int pos, int value)` Writes an int to the indicated position
`void` `writeLong(int pos, long value)` Writes a long to the indicated position
`void` `writeShort(int pos, short value)` Writes a short to the indicated position

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

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

### Field Detail

#### serialVersionUID

    public static final long serialVersionUID

See Also:
  Constant Field Values

### Constructor Detail

#### BlockIo

    public BlockIo()

Default constructor for serialization

### Method Detail

#### getView

    public BlockView getView()

Returns:
  the current view of the block.

#### setView

    public void setView(BlockView view)

Sets the current view of the block.

Parameters:
  `view` - the current view

#### readByte

    public byte readByte(int pos)

Reads a byte from the indicated position

Parameters:
  `pos` - the position at which we will read the byte
Returns:
  the read byte

#### writeByte

    public void writeByte(int pos,
                 byte value)

Writes a byte to the indicated position

Parameters:
  `pos` - The position where we want to write the value to
  `value` - the byte value we want to write into the BlockIo

#### readShort

    public short readShort(int pos)

Reads a short from the indicated position

Parameters:
  `pos` - the position at which we will read the short
Returns:
  the read short

#### writeShort

    public void writeShort(int pos,
                  short value)

Writes a short to the indicated position

Parameters:
  `pos` - The position where we want to write the value to
  `value` - the short value we want to write into the BlockIo

#### readInt

    public int readInt(int pos)

Reads an int from the indicated position

Parameters:
  `pos` - the position at which we will read the int
Returns:
  the read int

#### writeInt

    public void writeInt(int pos,
                int value)

Writes an int to the indicated position

Parameters:
  `pos` - The position where we want to write the value to
  `value` - the int value we want to write into the BlockIo

#### readLong

    public long readLong(int pos)

Reads a long from the indicated position

Parameters:
  `pos` - the position at which we will read the long
Returns:
  the read long

#### writeLong

    public void writeLong(int pos,
                 long value)

Writes a long to the indicated position

Parameters:
  `pos` - The position where we want to write the value to
  `value` - the long value we want to write into the BlockIo

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

implement externalizable interface

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

implement externalizable interface

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`