home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupportInternational / i18n.jar / sun / io / ByteToCharEUC.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.6 KB  |  91 lines

  1. package sun.io;
  2.  
  3. public abstract class ByteToCharEUC extends ByteToCharConverter {
  4.    // $FF: renamed from: G0 int
  5.    private final int field_0;
  6.    // $FF: renamed from: G1 int
  7.    private final int field_1 = 1;
  8.    private final int SS2 = 142;
  9.    private final int SS3 = 143;
  10.    private int firstByte;
  11.    private int state = 0;
  12.    protected String mappingTableG1;
  13.    protected String byteToCharTable;
  14.  
  15.    public int flush(char[] var1, int var2, int var3) throws MalformedInputException {
  16.       if (this.state != 0) {
  17.          this.reset();
  18.          super.badInputLength = 0;
  19.          throw new MalformedInputException();
  20.       } else {
  21.          this.reset();
  22.          return 0;
  23.       }
  24.    }
  25.  
  26.    public void reset() {
  27.       this.state = 0;
  28.       super.charOff = super.byteOff = 0;
  29.    }
  30.  
  31.    public int convert(byte[] var1, int var2, int var3, char[] var4, int var5, int var6) throws UnknownCharacterException, MalformedInputException, ConversionBufferFullException {
  32.       char var8 = '∩┐╜';
  33.       super.byteOff = var2;
  34.  
  35.       for(super.charOff = var5; super.byteOff < var3; ++super.byteOff) {
  36.          int var7 = var1[super.byteOff];
  37.          if (var7 < 0) {
  38.             var7 += 256;
  39.          }
  40.  
  41.          switch (this.state) {
  42.             case 0:
  43.                if (var7 == 142 || var7 == 143) {
  44.                   super.badInputLength = 1;
  45.                   throw new MalformedInputException();
  46.                }
  47.  
  48.                if (var7 <= 159) {
  49.                   var8 = this.byteToCharTable.charAt(var7);
  50.                } else {
  51.                   if (var7 < 161 || var7 > 254) {
  52.                      super.badInputLength = 1;
  53.                      throw new MalformedInputException();
  54.                   }
  55.  
  56.                   this.firstByte = var7;
  57.                   this.state = 1;
  58.                }
  59.                break;
  60.             case 1:
  61.                this.state = 0;
  62.                if (var7 < 161 || var7 > 254) {
  63.                   super.badInputLength = 1;
  64.                   throw new MalformedInputException();
  65.                }
  66.  
  67.                var8 = this.mappingTableG1.charAt((this.firstByte - 161) * 94 + var7 - 161);
  68.          }
  69.  
  70.          if (this.state == 0) {
  71.             if (var8 == '∩┐╜') {
  72.                if (!super.subMode) {
  73.                   super.badInputLength = 1;
  74.                   throw new UnknownCharacterException();
  75.                }
  76.  
  77.                var8 = super.subChars[0];
  78.             }
  79.  
  80.             if (super.charOff >= var6) {
  81.                throw new ConversionBufferFullException();
  82.             }
  83.  
  84.             var4[super.charOff++] = var8;
  85.          }
  86.       }
  87.  
  88.       return super.charOff - var5;
  89.    }
  90. }
  91.