com.ibm.opencard.buffer
Class Buffer
java.lang.Object
|
+--com.ibm.opencard.buffer.Buffer
- Direct Known Subclasses:
- DataBuffer, TLVBuffer
- public class Buffer
- extends java.lang.Object
Buffer objects are used to store data. This data may be a raw sequence of
bytes or a sequence of BER encoded TLVs. A Buffer object has a certain
capacity which is determined by the size of the byte array provided to the
constructor. If this capacity is exceeded by concatenating another Buffer
or appending additional data, the capacity is increased by reallocation
of memory. If you want to avoid reallocation of memory for performance
reasons, you should provided a byte array of sufficient size to the
constructor.
- Version:
- $Id: Buffer.java,v 1.1 1999/12/02 16:06:02 damke Exp $
- See Also:
Request
|
Constructor Summary |
Buffer(byte[] data,
int size)
This constructor creates a new Buffer from the given values. |
|
Method Summary |
void |
clear()
This method clears this buffer. |
byte[] |
data()
This method returns this buffer's data. |
int |
size()
This method returns this buffer's size. |
protected java.lang.String |
toHexString()
Converts the data in the buffer to character hex format. |
java.lang.String |
toString()
Converts the data in the buffer to a hexadecimal string. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Buffer
public Buffer(byte[] data,
int size)
- This constructor creates a new Buffer from the given values.
- Parameters:
data - A byte array containing datasize - The size of valid data contained in the data array. If this
size is bigger than the actual length of the byte array,
it is set to the length of the byte array.
size
public int size()
- This method returns this buffer's size.
- Returns:
- This buffer's size.
data
public byte[] data()
- This method returns this buffer's data.
- Returns:
- This buffer's data.
clear
public void clear()
- This method clears this buffer.
toHexString
protected java.lang.String toHexString()
- Converts the data in the buffer to character hex format.
- Returns:
- A String containing the data in hex format.
toString
public java.lang.String toString()
- Converts the data in the buffer to a hexadecimal string.
- Returns:
- A String containing the data in hex format.
- Overrides:
- toString in class java.lang.Object
|