com.virtuosotechnologies.lib.conversion
Interface UnStringizer

All Known Implementing Classes:
Base64UnStringizer

public interface UnStringizer

Something that converts a string to binary data.


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?
 

Method Detail

isFinished

public boolean isFinished()
Is the UnStringizer finished?

Returns:
true if the UnStringizer is finished.

finish

public void finish()
Finish the conversion


addCharacters

public void addCharacters(char[] data,
                          int start,
                          int length)
Add character data to the 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

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.

Returns:
number of characters

getWaitingByteCount

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

Returns:
number of waiting bytes

getWaitingBytes

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

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.

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.