goldengate.common.file
Class DataBlock

java.lang.Object
  extended by goldengate.common.file.DataBlock

public class DataBlock
extends Object

Main object implementing Data Block whaveter the mode, type, structure used.

Author:
Frederic Bregier

Constructor Summary
DataBlock()
          Create a simple and empty DataBlock
 
Method Summary
 void clear()
          Clear the object
 org.jboss.netty.buffer.ChannelBuffer getBlock()
           
 int getByteCount()
           
 byte getByteCountLower()
           
 byte getByteCountUpper()
           
 byte[] getByteMarkers()
           
 byte getDescriptor()
           
 int[] getMarkers()
           
 boolean isCleared()
          Is this Block cleared
 boolean isEOF()
           
 boolean isEOR()
           
 boolean isERROR()
           
 boolean isRESTART()
           
 void setBlock(org.jboss.netty.buffer.ChannelBuffer block)
          Set the block and the byte count according to the block
 void setByteCount(byte upper, byte lower)
           
 void setByteCount(int byteCount)
           
 void setDescriptor(int descriptor)
           
 void setEOF(boolean isEOF)
           
 void setEOR(boolean isEOR)
           
 void setERROR(boolean isERROR)
           
 void setMarkers(int[] markers)
          Set the markers and the byte count
 void setRESTART(boolean isRESTART)
           
static String toBinaryString(byte[] bytes, boolean cutted)
          Translate the given array of byte into a string in binary format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBlock

public DataBlock()
Create a simple and empty DataBlock

Method Detail

getBlock

public org.jboss.netty.buffer.ChannelBuffer getBlock()
Returns:
the block

setBlock

public void setBlock(org.jboss.netty.buffer.ChannelBuffer block)
Set the block and the byte count according to the block

Parameters:
block - the block to set

getByteCount

public int getByteCount()
Returns:
the byteCount

setByteCount

public void setByteCount(int byteCount)
Parameters:
byteCount - the byteCount to set

setByteCount

public void setByteCount(byte upper,
                         byte lower)
Parameters:
upper - upper byte of the 2 bytes length
lower - lower byte of the 2 bytes length

getByteCountUpper

public byte getByteCountUpper()
Returns:
the Upper byte of the byte count

getByteCountLower

public byte getByteCountLower()
Returns:
the Lower byte of the byte count

getDescriptor

public byte getDescriptor()
Returns:
the descriptor

setDescriptor

public void setDescriptor(int descriptor)
Parameters:
descriptor - the descriptor to set

isEOF

public boolean isEOF()
Returns:
the isEOF

setEOF

public void setEOF(boolean isEOF)
Parameters:
isEOF - the isEOF to set

isEOR

public boolean isEOR()
Returns:
the isEOR

setEOR

public void setEOR(boolean isEOR)
Parameters:
isEOR - the isEOR to set

isERROR

public boolean isERROR()
Returns:
the isERROR

setERROR

public void setERROR(boolean isERROR)
Parameters:
isERROR - the isERROR to set

isRESTART

public boolean isRESTART()
Returns:
the isRESTART

setRESTART

public void setRESTART(boolean isRESTART)
Parameters:
isRESTART - the isRESTART to set

getMarkers

public int[] getMarkers()
Returns:
the markers

getByteMarkers

public byte[] getByteMarkers()
Returns:
the 6 bytes representation of the markers

setMarkers

public void setMarkers(int[] markers)
Set the markers and the byte count

Parameters:
markers - the markers to set

clear

public void clear()
Clear the object


isCleared

public boolean isCleared()
Is this Block cleared

Returns:
True if this Block is cleared

toBinaryString

public static String toBinaryString(byte[] bytes,
                                    boolean cutted)
Translate the given array of byte into a string in binary format

Parameters:
bytes -
cutted - True if each Byte should be 'blank' separated or not
Returns:
the string


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.