home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / jce.jar / javax / crypto / CipherOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-07-27  |  1.2 KB  |  78 lines

  1. package javax.crypto;
  2.  
  3. import java.io.FilterOutputStream;
  4. import java.io.IOException;
  5. import java.io.OutputStream;
  6.  
  7. public class CipherOutputStream extends FilterOutputStream {
  8.    // $FF: renamed from: a javax.crypto.Cipher
  9.    private Cipher field_0;
  10.    // $FF: renamed from: b java.io.OutputStream
  11.    private OutputStream field_1;
  12.    // $FF: renamed from: c byte[]
  13.    private byte[] field_2 = new byte[1];
  14.    // $FF: renamed from: d byte[]
  15.    private byte[] field_3;
  16.  
  17.    public CipherOutputStream(OutputStream var1, Cipher var2) {
  18.       super(var1);
  19.       this.field_1 = var1;
  20.       this.field_0 = var2;
  21.    }
  22.  
  23.    protected CipherOutputStream(OutputStream var1) {
  24.       super(var1);
  25.       this.field_1 = var1;
  26.       this.field_0 = new NullCipher();
  27.    }
  28.  
  29.    public void write(int var1) throws IOException {
  30.       this.field_2[0] = (byte)var1;
  31.       this.field_3 = this.field_0.update(this.field_2, 0, 1);
  32.       if (this.field_3 != null) {
  33.          this.field_1.write(this.field_3);
  34.          this.field_3 = null;
  35.       }
  36.  
  37.    }
  38.  
  39.    public void write(byte[] var1) throws IOException {
  40.       this.write(var1, 0, var1.length);
  41.    }
  42.  
  43.    public void write(byte[] var1, int var2, int var3) throws IOException {
  44.       this.field_3 = this.field_0.update(var1, var2, var3);
  45.       if (this.field_3 != null) {
  46.          this.field_1.write(this.field_3);
  47.          this.field_3 = null;
  48.       }
  49.  
  50.    }
  51.  
  52.    public void flush() throws IOException {
  53.       if (this.field_3 != null) {
  54.          this.field_1.write(this.field_3);
  55.          this.field_3 = null;
  56.       }
  57.  
  58.       this.field_1.flush();
  59.    }
  60.  
  61.    public void close() throws IOException {
  62.       try {
  63.          this.field_3 = this.field_0.doFinal();
  64.       } catch (IllegalBlockSizeException var3) {
  65.          this.field_3 = null;
  66.       } catch (BadPaddingException var4) {
  67.          this.field_3 = null;
  68.       }
  69.  
  70.       try {
  71.          this.flush();
  72.       } catch (IOException var2) {
  73.       }
  74.  
  75.       super.out.close();
  76.    }
  77. }
  78.