jSyncManager

org.jSyncManager.API.Protocol.Util
Class DLPBlock

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.Util.DLPBlock
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AddressAppBlock, DateBookAppBlock, ExpenseAppBlock, MailAppBlock, MemoAppBlock, NotepadAppBlock, ToDoListAppBlock

public class DLPBlock
extends java.lang.Object
implements java.io.Serializable

A class that represents database information blocks. This class stores a data block. This is typically used in Palm databases to store the application block and the sort block.

Version:
$Revision: 1.7 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/14 03:51:27 $.
See Also:
Serialized Form

Field Summary
protected  int blockSize
          Holds the size of the block.
protected  byte[] data
          Holds the data array representing this block.
 
Constructor Summary
DLPBlock()
          Creates an empty block, with size 0.
DLPBlock(byte[] inputData)
          Creates a new block based on the input byte array.
 
Method Summary
protected  void generateData()
          Generates the data block from a set of class fields.
 int getBlockSize()
          Returns the size of this block.
 byte[] getData()
          Retreives the byte array containing the data in this block.
protected  void parseFields()
          Parses the data block into a set of fields.
 void setData(byte[] data)
          Sets the data byte array for this block.
 java.lang.String toString()
          Returns a human-readable hex representation of the block data.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

blockSize

protected int blockSize
Holds the size of the block.

data

protected byte[] data
Holds the data array representing this block.
Constructor Detail

DLPBlock

public DLPBlock()
Creates an empty block, with size 0.

DLPBlock

public DLPBlock(byte[] inputData)
         throws DLPFunctionCallException
Creates a new block based on the input byte array.
Parameters:
inputData - the input byte array to be parsed.
Throws:
DLPFunctionCallException - thrown if any parsing problem is encountered.
Method Detail

generateData

protected void generateData()
Generates the data block from a set of class fields. This method is called to take the input fields in the block class, and to form a byte array representation of the block. This method is intended for implementation by subclasses. In this class, its implementation is null.

getBlockSize

public int getBlockSize()
Returns the size of this block. This is the size of the block as reported by the Palm at generation time. To get the actual number of bytes in the current data array, you should instead use getData().length.
Returns:
the size of this block.

getData

public byte[] getData()
Retreives the byte array containing the data in this block.
Returns:
the byte array containing the data in this block.

parseFields

protected void parseFields()
Parses the data block into a set of fields. This method is called to take the input byte array in the block class, and to parse it into its representitive fields. This method is intended for implementation by subclasses. In this class, its implementation is null.

setData

public void setData(byte[] data)
Sets the data byte array for this block.
Parameters:
data - the byte array containing block information.

toString

public java.lang.String toString()
Returns a human-readable hex representation of the block data.
Overrides:
toString in class java.lang.Object
Returns:
java.lang.String

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.