// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov Date: 2009-01-06 ¿ÀÀü 12:26:53 // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ByteToCharEUC.java package sun.io; // Referenced classes of package sun.io: // ByteToCharConverter, MalformedInputException, ConversionBufferFullException, UnknownCharacterException public abstract class ByteToCharEUC extends ByteToCharConverter { public ByteToCharEUC() { convertType = 0; mask = 65535; inLen = 0; shift = 0; state = 0; } public String getStringData() { return index2; } public short[] getIndex() { return index1; } public int getShift() { return shift; } public char[] getCharData() { return singleByte; } public byte[] getByteData() { byte abyte0[] = new byte[1]; abyte0[0] = (byte)convertType; return abyte0; } protected void setType(int i) { convertType = i; } public int flush(char ac[], int i, int j) throws MalformedInputException { if(state != 0) { reset(); badInputLength = 0; throw new MalformedInputException(); } else { reset(); return 0; } } public void reset() { state = 0; charOff = byteOff = 0; } protected int newState(int i) { return 0; } protected int getC4Mask(int i) { return -1; } public int convert(byte abyte0[], int i, int j, char ac[], int k, int l) throws UnknownCharacterException, MalformedInputException, ConversionBufferFullException { byteOff = i; charOff = k; for(; byteOff < j; byteOff++) { int k1 = abyte0[byteOff] & 0xff; int i1 = 65534; int j1 = state; switch(state) { case 0: // '\0' if(convertType == 0) { for(; k1 < 128; k1 = abyte0[byteOff] & 0xff) { i1 = singleByte[k1]; if(charOff >= l) throw new ConversionBufferFullException(); ac[charOff++] = singleByte[k1]; if(++byteOff >= j) return charOff - k; } i1 = singleByte[k1]; if(i1 == 65535) { state = newState(k1); if(state == 0) { //badInputLength = 1; //throw new MalformedInputException(); continue; } } } if(i1 == 65534) { if(convertType == 1 || k1 < 161 || k1 > 254) { // badInputLength = 1; // throw new MalformedInputException(); continue; } firstByte = k1; if(convertType > 2) { mask = convertType != 4 ? 65407 : 32767; state = 6; } else { state = 1; } } break; case 1: // '\001' state = 0; if(k1 < 161 || k1 > 254) { // badInputLength = 1; // throw new MalformedInputException(); continue; } if(shift == 0) { i1 = index2.charAt(((firstByte - 161) * 94 + k1) - 161); } else { k1 |= firstByte << 8; i1 = index2.charAt(index1[(k1 & mask1) >> shift] + (k1 & mask2)); } break; case 3: // '\003' mask = 65407; inLen = 3; // fall through case 5: // '\005' firstByte = k1; if(k1 < 161 || k1 > 254) { state = 0; // badInputLength = 2; // throw new MalformedInputException(); continue; } if(mask < 8192 && k1 > 191) firstByte = 191; state = 6; break; case 6: // '\006' state = 0; if(k1 < 161 || k1 > 254) { // badInputLength = inLen; // throw new MalformedInputException(); continue; } k1 |= firstByte << 8; k1 &= mask; i1 = index2.charAt(index1[(k1 & mask1) >> shift] + (k1 & mask2)); break; case 2: // '\002' state = 0; if(k1 < 161 || k1 > 254) { // badInputLength = 1; // throw new MalformedInputException(); continue; } k1 = (k1 & 0x7f) + 256; i1 = index2.charAt(index1[(k1 & mask1) >> shift] + (k1 & mask2)); break; case 4: // '\004' mask = getC4Mask(k1); if(mask < 0) { state = 0; // badInputLength = 1; // throw new MalformedInputException(); continue; } inLen = 4; state = 5; break; } if(state != 0) continue; if(i1 < 2) if(subMode) { i1 = subChars[0]; } else { badInputLength = 1; throw new UnknownCharacterException(); } if(charOff >= l) { state = j1; throw new ConversionBufferFullException(); } ac[charOff++] = (char)i1; } return charOff - k; } protected final int G0 = 0; protected final int G1 = 1; protected final int J2 = 2; protected final int J3 = 3; protected final int C4 = 4; private final int C3 = 5; private final int G4 = 6; private int firstByte; private int state; private int convertType; private int mask; private int inLen; protected int shift; protected int mask1; protected int mask2; protected short index1[]; protected String index2; protected char singleByte[]; }