/*
* $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/lib/TKIso88591Converter.java,v 1.7 2002/01/21 09:50:17 mischa Exp $
*
*/
package com.teamkonzept.lib;
/**
* Konvertierungsklasse fuer ISO-8859-1
* Nutzen ??? gleiche wie AnsiConverter ?
* @author $Author: mischa $
* @version $Revision: 1.7 $
*/
public class TKIso88591Converter extends TKConverter {
public String getName()
{
return "ISO-8859_1";
}
public int getMaxBytesPerChar()
{
return 1;
}
public int minCharSize(int byteCount)
{
return byteCount;
}
public int charsToBytes(char src[], byte dst[], int srcBegin, int length, int dstBegin)
{
int lastPos = srcBegin+length;
int firstPos = dstBegin;
for( int i=srcBegin; i<lastPos; i++ ) {
char c = src[i];
if( c <= '\u00FF' ) {
dst[ dstBegin++ ] = (byte) c;
}
}
return dstBegin - firstPos;
}
public int bytesToChars(byte src[], char dst[], int srcBegin, int length, int dstBegin)
{
int lastPos = srcBegin+length;
//int firstPos = dstBegin;
for( int i = srcBegin; i < lastPos; i++ ) {
dst[dstBegin++] = (char) src[i];
}
return length;
}
public String bytesToString( byte[] code )
{
return new String( code, 0 );
}
public byte[] stringToBytes( String src )
{
int len = src.length();
byte[] temp = new byte[ len ];
src.getBytes( 0, len, temp, 0 );
return temp;
}
}
|