jason.client
Class Appender

java.lang.Object
  |
  +--jason.client.Appender
Direct Known Subclasses:
CipherAppender, SignatureAppender

public class Appender
extends java.lang.Object

Title: Javacard As Secure Object Store

Description: Serializer for primitive data types

Copyright: Copyright (c) 2002

Company: University of Twente


Field Summary
protected  byte[] buffer
          Internal buffer
protected  boolean storeLengths
          Indicates whether the length of an array should be stored as well
 
Constructor Summary
Appender()
          Makes a new Appender with the storeLengths variable set to true.
Appender(boolean storeLengths)
          Makes a new Appender.
 
Method Summary
 void append(Appender appender)
          Appends another appender (i.e. appending the internal buffer of the other Appender).
 void append(boolean b)
          Adds a single boolean.
 void append(byte b)
          Appends a single byte.
 void append(byte[] b)
          Appends the whole byte array.
 void append(byte[] b, int offset, int length)
          Appends only the specified part of the array.
 void append(short s)
          Appends a single short.
protected  void appendIntern(byte[] b)
          Appends to whole array.
protected  void appendIntern(byte[] b, int offset, int length)
          Build a bigger array containing the old array and the specified part of the given array.
 byte[] getBuffer()
          Gets the internal buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storeLengths

protected boolean storeLengths
Indicates whether the length of an array should be stored as well


buffer

protected byte[] buffer
Internal buffer

Constructor Detail

Appender

public Appender()
Makes a new Appender with the storeLengths variable set to true.


Appender

public Appender(boolean storeLengths)
Makes a new Appender.

Parameters:
storeLengths - Indicates whether the length of an array should be stored as well
Method Detail

appendIntern

protected void appendIntern(byte[] b,
                            int offset,
                            int length)
Build a bigger array containing the old array and the specified part of the given array. Subklasses of Appender only have to modify this method.

Parameters:
b - The data to add to the internal buffer
offset - Offset within b
length - Length of bytes to copy

appendIntern

protected void appendIntern(byte[] b)
Appends to whole array.

Parameters:
b - Data to be added

append

public void append(byte b)
Appends a single byte.

Parameters:
b - Data to be added

append

public void append(boolean b)
Adds a single boolean.

Parameters:
b - Data to be added

append

public void append(short s)
Appends a single short.

Parameters:
s - Data to be added

append

public void append(byte[] b,
                   int offset,
                   int length)
Appends only the specified part of the array.

Parameters:
b - Data to be added
offset - Offset within b
length - Length of bytes to be copied

append

public void append(byte[] b)
Appends the whole byte array.

Parameters:
b - Data to be added

append

public void append(Appender appender)
Appends another appender (i.e. appending the internal buffer of the other Appender).

Parameters:
appender - The Appender to be appended

getBuffer

public byte[] getBuffer()
Gets the internal buffer. Note that it is the buffer itself and not a copy.

Returns:
The internal buffer.