Logo Search packages:      
Sourcecode: jlha-utils version File versions  Download package

void org::jlhafrontend::SJIS2EUCJPOutputStream::write ( int  b  )  throws java.io.IOException [inline]

Writes the specified byte to the output stream

Parameters:
b the byte

Definition at line 62 of file SJIS2EUCJPOutputStream.java.

Referenced by write().

                                                        {
        b = b & 0x00ff;
      if (!lastByteFlag) {
          if (b <= 0x80 || b > 0xfc) { /* US-ASCII compatible */
            super.write(b);
            return;
          } else if (0xa0 <= b && b < 0xe0) { /* kana */
            super.write(0x8e);
            super.write(b);
            return;
          } else {
            lastByteFlag=true;
            lastByte = b;
            return;
          }
      } else {
          lastByteFlag=false;
          if (lastByte >= 0xa0) {
            lastByte -= 0x40;
          }
          lastByte = (lastByte-0x81)*2+0x21;
          if (b >= 0x9f) {
            b = b - 0x9f + 0x21;
            lastByte++;
          } else {
            if (b >= 0x7f) {
                b--;
            }
            b -= 0x1f;
          }
          b = b & 0xff;
          lastByte = lastByte & 0xff;
          b = b | 0x80;
          lastByte = lastByte | 0x80;
          super.write(lastByte);
          lastByte=0;
          super.write(b);
      }         
    }


Generated by  Doxygen 1.6.0   Back to index