home *** CD-ROM | disk | FTP | other *** search
/ Online Today 2000 January / Onto0100.iso / pc / JAVA / MSJAVX86.EXE / xmldso.cab / com / ms / xml / util / ByteSwapOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  551 b   |  33 lines

  1. package com.ms.xml.util;
  2.  
  3. import java.io.IOException;
  4. import java.io.OutputStream;
  5.  
  6. class ByteSwapOutputStream extends OutputStream {
  7.    private OutputStream out;
  8.    private int byte1;
  9.  
  10.    public void close() throws IOException {
  11.       if (this.byte1 != -2) {
  12.          this.out.write(0);
  13.          this.out.write(this.byte1);
  14.       }
  15.  
  16.    }
  17.  
  18.    public ByteSwapOutputStream(OutputStream var1) {
  19.       this.out = var1;
  20.       this.byte1 = -2;
  21.    }
  22.  
  23.    public void write(int var1) throws IOException {
  24.       if (this.byte1 == -2) {
  25.          this.byte1 = var1;
  26.       } else {
  27.          this.out.write(var1);
  28.          this.out.write(this.byte1);
  29.          this.byte1 = -2;
  30.       }
  31.    }
  32. }
  33.