com.dalsemi.io
Class ByteToCharISO8859_1
java.lang.Object
|
+--com.dalsemi.io.ByteToCharConverter
|
+--com.dalsemi.io.ByteToCharISO8859_1
- public class ByteToCharISO8859_1
- extends ByteToCharConverter
Method Summary |
int |
convert(byte[] src,
int srcStart,
int srcEnd,
char[] dst,
int dstStart,
int dstEnd)
Converts the specified byte array into a char array based on
this ByteToCharConverter 's encoding scheme. |
int |
flush(char[] buff,
int start,
int end)
Tells the ByteToCharConverter to convert
any unconverted data it has internally stored. |
int |
getMaxCharCount(byte[] forThis,
int start,
int end)
Returns the number of characters that the specified byte
sequence will require for encoding. |
String |
getName()
Returns the name of this encoding scheme. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ByteToCharISO8859_1
public ByteToCharISO8859_1()
getMaxCharCount
public int getMaxCharCount(byte[] forThis,
int start,
int end)
- Description copied from class: ByteToCharConverter
- Returns the number of characters that the specified
byte
sequence will require for encoding. For instance, in UTF8
encoding, a one, two, or three byte sequence may encode to
one char
. This method should always be called before the
convert()
method. The value returned may not be the actual
number of converted characters that will be produced due to
conversion errors, but it will be the maximum that will be
produced.
- Overrides:
- getMaxCharCount in class ByteToCharConverter
- Tags copied from class: ByteToCharConverter
- Parameters:
forThis
- the byte sequence to determine the
required encoding sizestart
- offset into the byte array to begin processingend
- the ending offset in the byte array to stop processing.
The number of processed bytes will then be (end-start)
.- Returns:
- The number of bytes required to encode the specified
byte
sequence - See Also:
ByteToCharConverter.convert(byte[],int,int,char[],int,int)
convert
public int convert(byte[] src,
int srcStart,
int srcEnd,
char[] dst,
int dstStart,
int dstEnd)
- Description copied from class: ByteToCharConverter
- Converts the specified
byte
array into a char
array based on
this ByteToCharConverter
's encoding scheme. getMaxCharCount()
should
always be called first to find out how much room is required in the
destination char
array.
- Overrides:
- convert in class ByteToCharConverter
- Tags copied from class: ByteToCharConverter
- Parameters:
src
- the same byte array passed to getMaxCharCount()
srcStart
- the same starting offset as passed to getMaxCharCount()
srcEnd
- the same ending offset as passed to getMaxCharCount()
dst
- the destination character array.dstStart
- the offset to begin storing converted bytes in the
destination arraydstEnd
- the ending location for storing converted bytes into the
destination array. This argument may usually be ignored, as
the algorithm may choose to continue converting bytes until
finished.- Returns:
- number of characters created and stored from this character sequence
- Throws:
- CharConversionException - if an illegal byte sequence is encountered
that cannot be converted
- See Also:
ByteToCharConverter.getMaxCharCount(byte[],int,int)
,
ByteToCharConverter.flush(char[],int,int)
flush
public int flush(char[] buff,
int start,
int end)
- Description copied from class: ByteToCharConverter
- Tells the
ByteToCharConverter
to convert
any unconverted data it has internally stored.
Some ByteToCharConverter
's will store state between
calls to convert()
. Since the converter may be left in
an unknown state, the converter should be flushed to
notify it that no more input will be received. The converter
can handle any unfinished conversions before its output is
used.
- Overrides:
- flush in class ByteToCharConverter
- Tags copied from class: ByteToCharConverter
- Parameters:
buff
- the destination character arraystart
- the next available offset into the destination arrayend
- offset in the destination array to stop placing data
(may be ignored by some algorithms)- Returns:
- number of bytes that were stored in the destination array
from this call to
flush()
- Throws:
- CharConversionException - if an illegal character is encountered that cannot be converted
- See Also:
ByteToCharConverter.convert(byte[],int,int,char[],int,int)
getName
public String getName()
- Description copied from class: ByteToCharConverter
- Returns the name of this encoding scheme. For example, "UTF8".
- Overrides:
- getName in class ByteToCharConverter
- Tags copied from class: ByteToCharConverter
- Returns:
- String representing the name of this encoding scheme.