com.virtuosotechnologies.lib.conversion
Class Base64UnStringizer

java.lang.Object
  extended bycom.virtuosotechnologies.lib.conversion.Base64UnStringizer
All Implemented Interfaces:
UnStringizer

public class Base64UnStringizer
extends Object
implements UnStringizer

An UnStringizer that uses Base64 conversion. This class is fully synchronized and thread safe.


Constructor Summary
Base64UnStringizer()
          Constructor
 
Method Summary
 void addCharacters(char[] data, int start, int length)
          Add character data to the UnStringizer
 void addCharacters(String str)
          Add character data to the UnStringizer
 void finish()
          Finish the conversion
 int getTotalStringLength()
          Get the total number of characters that have been added.
 int getWaitingByteCount()
          Get the number of deencoded bytes ready to be fetched
 byte[] getWaitingBytes(int count)
          Get the given number of bytes as a byte array.
 int getWaitingBytes(int count, byte[] buffer, int pos)
          Copy the given number of bytes to an existing byte array.
 boolean isFinished()
          Is the UnStringizer finished?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64UnStringizer

public Base64UnStringizer()
Constructor

Method Detail

isFinished

public boolean isFinished()
Is the UnStringizer finished?

Specified by:
isFinished in interface UnStringizer
Returns:
true if the UnStringizer is finished.

finish

public void finish()
Finish the conversion

Specified by:
finish in interface UnStringizer

addCharacters

public void addCharacters(char[] data,
                          int start,
                          int length)
Add character data to the UnStringizer

Specified by:
addCharacters in interface UnStringizer
Parameters:
data - character array
start - index into character array
length - number of characters to add
Throws:
IllegalStateException - UnStringizer is already finished.
ArrayIndexOutOfBoundsException - bad start and/or length value.

addCharacters

public void addCharacters(String str)
Add character data to the UnStringizer

Specified by:
addCharacters in interface UnStringizer
Parameters:
str - characters to add
Throws:
IllegalStateException - UnStringizer is already finished.

getTotalStringLength

public int getTotalStringLength()
Get the total number of characters that have been added.

Specified by:
getTotalStringLength in interface UnStringizer
Returns:
number of characters

getWaitingByteCount

public int getWaitingByteCount()
Get the number of deencoded bytes ready to be fetched

Specified by:
getWaitingByteCount in interface UnStringizer
Returns:
number of waiting bytes

getWaitingBytes

public byte[] getWaitingBytes(int count)
Get the given number of bytes as a byte array.

Specified by:
getWaitingBytes in interface UnStringizer
Parameters:
count - maximum number of bytes to get, or -1 to get all bytes.
Returns:
an array containing the bytes

getWaitingBytes

public int getWaitingBytes(int count,
                           byte[] buffer,
                           int pos)
Copy the given number of bytes to an existing byte array.

Specified by:
getWaitingBytes in interface UnStringizer
Parameters:
count - maximum number of bytes to get.
buffer - array to add the bytes to
pos - position in the buffer array
Returns:
the actual number of bytes gotten.