Class Block

java.lang.Object
   |
   +----Block

public class Block
extends Object
An array of bytes.

Author:
Ray Ontko

Variable Index

 o bytes
The array of bytes for this block.

Constructor Index

 o Block()
Construct a block.
 o Block(short)
Construct a block with a given block size.

Method Index

 o getBlockSize()
Get the block size in bytes for this Block.
 o read(RandomAccessFile)
Read a block from a file at the current position.
 o setBlockSize(short)
Set the block size in bytes for this Block.
 o write(RandomAccessFile)
Write a block to a file at the current position.

Variables

 o bytes
 public byte bytes[]
The array of bytes for this block.

Constructors

 o Block
 public Block()
Construct a block.

 o Block
 public Block(short blockSize)
Construct a block with a given block size.

Parameters:
blockSize - the block size in bytes

Methods

 o setBlockSize
 public void setBlockSize(short newBlockSize)
Set the block size in bytes for this Block.

Parameters:
newBlockSize - the new block size in bytes
 o getBlockSize
 public short getBlockSize()
Get the block size in bytes for this Block.

Returns:
the block size in bytes
 o read
 public void read(RandomAccessFile file) throws IOException, EOFException
Read a block from a file at the current position.

Parameters:
file - the random access file from which to read
Throws: EOFException
if attempt to read past end of file
Throws: IOException
if an I/O error occurs
 o write
 public void write(RandomAccessFile file) throws IOException
Write a block to a file at the current position.

Parameters:
file - the random access file to which to write
Throws: IOException
if an I/O error occurs