com.dalsemi.io
Class CharToByteISO8859_1
java.lang.Object
|
+--com.dalsemi.io.CharToByteConverter
|
+--com.dalsemi.io.CharToByteISO8859_1
- public class CharToByteISO8859_1
- extends CharToByteConverter
Method Summary |
int |
convert(char[] src,
int srcStart,
int srcEnd,
byte[] dst,
int dstStart,
int dstEnd)
Converts the specified char array into a byte array based on
this CharToByteConverter 's encoding scheme. |
int |
flush(byte[] buff,
int start,
int end)
Tells the CharToByteConverter to convert
any unconverted data it has internally stored. |
int |
getMaxByteCount(char[] forThis,
int start,
int end)
Returns the number of bytes that the specified character
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 |
CharToByteISO8859_1
public CharToByteISO8859_1()
getMaxByteCount
public int getMaxByteCount(char[] forThis,
int start,
int end)
- Description copied from class: CharToByteConverter
- Returns the number of bytes that the specified character
sequence will require for encoding. For instance, in UTF8
encoding, a character can be encoded as one, two, or three
bytes. This method should always be called before the
convert()
method. The value returned may not be the actual
number of converted bytes that will be produced due to
conversion errors, but it will be the maximum that will be
produced.
- Overrides:
- getMaxByteCount in class CharToByteConverter
- Tags copied from class: CharToByteConverter
- Parameters:
forThis
- contains the character sequence that will be encoded
to determine the number of bytes requiredstart
- offset into the character array to begin processingend
- ending offset in the character array to end processing.
The number of processed characters will then be (end-start)
.- Returns:
- The number of bytes required to encode the specified character sequence.
- See Also:
CharToByteConverter.convert(char[],int,int,byte[],int,int)
convert
public int convert(char[] src,
int srcStart,
int srcEnd,
byte[] dst,
int dstStart,
int dstEnd)
- Description copied from class: CharToByteConverter
- Converts the specified
char
array into a byte
array based on
this CharToByteConverter
's encoding scheme. getMaxByteCount()
should
always be called first to find out how much room is required in the
destination byte array.
- Overrides:
- convert in class CharToByteConverter
- Tags copied from class: CharToByteConverter
- Parameters:
src
- the same character array passed to getMaxByteCount()
srcStart
- the same starting offset as passed to getMaxByteCount()
srcEnd
- the same ending offset as passed to getMaxByteCount()
dst
- the destination byte
arraydstStart
- offset to begin storing converted characters in the
destination arraydstEnd
- the ending location for storing converted characters into the
destination array. This argument may usually be ignored, as
the algorithm may choose to continue converting characters until
finished.- Returns:
- number of bytes created and stored from this character sequence
- Throws:
- CharConversionException - If an illegal character is encountered that cannot be converted
- See Also:
CharToByteConverter.getMaxByteCount(char[],int,int)
,
CharToByteConverter.flush(byte[],int,int)
flush
public int flush(byte[] buff,
int start,
int end)
- Description copied from class: CharToByteConverter
- Tells the
CharToByteConverter
to convert
any unconverted data it has internally stored.
Some CharToByteConverter
'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 CharToByteConverter
- Tags copied from class: CharToByteConverter
- Parameters:
buff
- the destination byte 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:
CharToByteConverter.convert(char[],int,int,byte[],int,int)
getName
public String getName()
- Description copied from class: CharToByteConverter
- Returns the name of this encoding scheme. For example, "UTF8".
- Overrides:
- getName in class CharToByteConverter
- Tags copied from class: CharToByteConverter
- Returns:
- the name of this encoding scheme