mediaframe.mpeg1
Class DataBlock

java.lang.Object
  |
  +--mediaframe.mpeg1.DataBlock

public final class DataBlock
extends java.lang.Object

The DataBlock class represents a block of 64 bytes. This class contains methods for storing and reading the movie data. It contains the link to the next datablock with the movie data.

Author:
Konstantin Belous

Field Summary
static int BLOCKSIZE
          The length of the block in bytes.
 long[] data
          The movie's data.
 int lastSize
          The size the last information word (0-4).
 long lastWord
          The last 0-4 information bytes (the last information word).
private  DataBlock next
          The next datablock object.
 int size
          The size if the datablock.
 
Constructor Summary
DataBlock()
          Constructs a Datablock without data.
DataBlock(DataBlock prevBlock)
          Constructs an empty Datablock as a continue of the existed Datablock.
 
Method Summary
 void close()
          Closes this data block.
 DataBlock getNext()
          Gets the next Datablock object.
 boolean hasNext()
          Returns true if this data block has the next data block as a continue of it's data.
 boolean isFull()
          Returns true if this data block is full and can't store more data bytes.
 void setFirstWord(long word)
          Sets the first information word.
 void setNext(DataBlock nextBlock)
          Sets the next Datablock as a continue of this data block.
 void setSize(int size)
          Sets the size of this data block.
 void write(int Byte)
          Puts a byte into this data block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCKSIZE

public static final int BLOCKSIZE
The length of the block in bytes.

See Also:
Constant Field Values

size

public int size
The size if the datablock.


data

public long[] data
The movie's data.


lastWord

public long lastWord
The last 0-4 information bytes (the last information word).


lastSize

public int lastSize
The size the last information word (0-4).


next

private DataBlock next
The next datablock object.

Constructor Detail

DataBlock

public DataBlock()
Constructs a Datablock without data.


DataBlock

public DataBlock(DataBlock prevBlock)
Constructs an empty Datablock as a continue of the existed Datablock.

Parameters:
prevBlock - the previous Datablock
Method Detail

hasNext

public boolean hasNext()
Returns true if this data block has the next data block as a continue of it's data.

Returns:
true if this data block has the next data block as a continue of it's data.

setFirstWord

public void setFirstWord(long word)
Sets the first information word.

Parameters:
word - the first information word.

setNext

public void setNext(DataBlock nextBlock)
Sets the next Datablock as a continue of this data block.

Parameters:
nextBlock - the next Datablock object.

getNext

public DataBlock getNext()
Gets the next Datablock object.

Returns:
the next Datablock object.

setSize

public void setSize(int size)
Sets the size of this data block.

Parameters:
size - the size of this data block.

isFull

public boolean isFull()
Returns true if this data block is full and can't store more data bytes.

Returns:
true if this data block is full.

write

public void write(int Byte)
Puts a byte into this data block.

Parameters:
Byte - the byte of the movie's data.

close

public void close()
Closes this data block. Calculates the last information word (last 0-3 bytes of the information) and it's length.