public class ByteToCharISO8859_1 extends ByteToCharConverter
Constructor and Description |
---|
ByteToCharISO8859_1() |
Modifier and Type | Method and Description |
---|---|
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.
|
getConverter, getDefaultConverter
public int getMaxCharCount(byte[] forThis, int start, int end)
ByteToCharConverter
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.getMaxCharCount
in class ByteToCharConverter
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)
.ByteToCharConverter.convert(byte[],int,int,char[],int,int)
public int convert(byte[] src, int srcStart, int srcEnd, char[] dst, int dstStart, int dstEnd)
ByteToCharConverter
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.convert
in class ByteToCharConverter
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.ByteToCharConverter.getMaxCharCount(byte[],int,int)
,
ByteToCharConverter.flush(char[],int,int)
public int flush(char[] buff, int start, int end)
ByteToCharConverter
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.flush
in class ByteToCharConverter
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)ByteToCharConverter.convert(byte[],int,int,char[],int,int)
public String getName()
ByteToCharConverter
getName
in class ByteToCharConverter