## net.i2p.crypto
Class AESOutputStream

    java.lang.Object
      java.io.OutputStream
          java.io.FilterOutputStream
              net.i2p.crypto.AESOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable

    public class AESOutputStream

extends java.io.FilterOutputStream

This writes everything as CBC with PKCS#5 padding, but each block is padded so as soon as a block is received it can be decrypted (rather than wait for an arbitrary number of blocks to arrive). That means that each block sent will contain exactly one padding byte (unless it was flushed with numBytes % (BLOCK_SIZE-1) != 0, in which case that last block will be padded with up to 15 bytes). So we have an expansion factor of 6.25%. c'est la vie

Field Summary
`static float` `EXPANSION_FACTOR`

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`AESOutputStream(I2PAppContext context, java.io.OutputStream source, SessionKey key, byte[] iv)`

Method Summary
`void` `close()`
`void` `flush()`
`void` `write(byte[] src)`
`void` `write(byte[] src, int off, int len)`
`void` `write(int val)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EXPANSION_FACTOR

    public static final float EXPANSION_FACTOR

See Also:
  Constant Field Values

Constructor Detail

### AESOutputStream

    public AESOutputStream(I2PAppContext context,
                           java.io.OutputStream source,
                           SessionKey key,
                           byte[] iv)

Method Detail

### write

    public void write(int val)
               throws java.io.IOException

  Overrides:
    `write` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

### write

    public void write(byte[] src)
               throws java.io.IOException

  Overrides:
    `write` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

### write

    public void write(byte[] src,
                      int off,
                      int len)
               throws java.io.IOException

  Overrides:
    `write` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

### flush

    public void flush()
               throws java.io.IOException

  Specified by:
    `flush` in interface `java.io.Flushable`
  Overrides:
    `flush` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`