# ChannelOutputStream (sshj 0.7.0 API)
Date: 2012-01-08

## net.schmizz.sshj.connection.channel
Class ChannelOutputStream

    java.lang.Object
      java.io.OutputStream
          net.schmizz.sshj.connection.channel.ChannelOutputStream

All Implemented Interfaces:
  Closeable, Flushable, ErrorNotifiable

    public final class ChannelOutputStream

extends OutputStream
implements ErrorNotifiable

`OutputStream` for channels. Buffers data upto the remote window's maximum packet size. Data can also be flushed via `flush()` and is also flushed on `close()`.

Nested Class Summary

Nested classes/interfaces inherited from interface net.schmizz.sshj.common.ErrorNotifiable
`ErrorNotifiable.Util`

Constructor Summary
`ChannelOutputStream(Channel chan, Transport trans, Window.Remote win)`

Method Summary
`void` `close()`
`void` `flush()` Send all data currently buffered.
`void` `notifyError(SSHException error)` Notifies this object of an `error`.
`void` `setClosed()`
`String` `toString()`
`void` `write(byte[] data, int off, int len)`
`void` `write(int w)`

Methods inherited from class java.io.OutputStream
`write`

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

Constructor Detail

### ChannelOutputStream

    public ChannelOutputStream(Channel chan,
                               Transport trans,
                               Window.Remote win)

Method Detail

### write

    public void write(int w)
               throws IOException

  Specified by:
    `write` in class `OutputStream`
  Throws:
    `IOException`

### write

    public void write(byte[] data,
                      int off,
                      int len)
               throws IOException

  Overrides:
    `write` in class `OutputStream`
  Throws:
    `IOException`

### notifyError

    public void notifyError(SSHException error)

  Description copied from interface: `ErrorNotifiable`
  Notifies this object of an `error`.

  Specified by:
    `notifyError` in interface `ErrorNotifiable`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `Closeable`
  Overrides:
    `close` in class `OutputStream`
  Throws:
    `IOException`

### setClosed

    public void setClosed()

### flush

    public void flush()
               throws IOException

  Send all data currently buffered. If window space is exhausted in the process, this will block until it is expanded by the server.

  Specified by:
    `flush` in interface `Flushable`
  Overrides:
    `flush` in class `OutputStream`
  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2009-2012. All Rights Reserved.