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

void org::jlhafrontend::EUCJP2SJISOutputStream::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 EUCJP2SJISOutputStream.java.

Referenced by write().

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


Generated by  Doxygen 1.6.0   Back to index