com.virtuosotechnologies.lib.conversion
Interface Stringizer

All Known Implementing Classes:
Base64Stringizer

public interface Stringizer

Something that converts binary data to a string.


Method Summary
 void addBytes(byte[] data, int start, int length)
          Add binary data to the Stringizer
 void finish()
          Finish the conversion
 int getTotalDataLength()
          Get the total number of bytes of binary data that have been added.
 int getWaitingCharacterCount()
          Get the number of encoded characters ready to be fetched
 String getWaitingCharacters(int count)
          Get the given number of characters as a String.
 int getWaitingCharacters(int count, StringBuffer buffer)
          Add the given number of characters to a StringBuffer.
 boolean isFinished()
          Is the Stringizer finished?
 

Method Detail

isFinished

public boolean isFinished()
Is the Stringizer finished?

Returns:
true if the Stringizer is finished.

finish

public void finish()
Finish the conversion


addBytes

public void addBytes(byte[] data,
                     int start,
                     int length)
Add binary data to the Stringizer

Parameters:
data - data array
start - index into data array
length - number of bytes to add
Throws:
IllegalStateException - Stringizer is already finished.
ArrayIndexOutOfBoundsException - bad start and/or length value.

getTotalDataLength

public int getTotalDataLength()
Get the total number of bytes of binary data that have been added.

Returns:
number of bytes

getWaitingCharacterCount

public int getWaitingCharacterCount()
Get the number of encoded characters ready to be fetched

Returns:
number of waiting characters

getWaitingCharacters

public String getWaitingCharacters(int count)
Get the given number of characters as a String.

Parameters:
count - maximum number of characters to get, or -1 to get all characters.
Returns:
a String containing the characters

getWaitingCharacters

public int getWaitingCharacters(int count,
                                StringBuffer buffer)
Add the given number of characters to a StringBuffer.

Parameters:
count - maximum number of characters to get, or -1 to get all characters.
buffer - StringBuffer to add the characters to
Returns:
the actual number of characters gotten.