Package org.apache.commons.net.telnet
Class TelnetOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.net.telnet.TelnetOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
final class TelnetOutputStream extends java.io.OutputStreamWraps an output stream.In binary mode, the only conversion is to double IAC.
In ASCII mode, if convertCRtoCRLF is true (currently always true), any CR is converted to CRLF. IACs are doubled. Also a bare LF is converted to CRLF and a bare CR is converted to CR\0
-
-
Field Summary
Fields Modifier and Type Field Description private TelnetClient__clientprivate boolean__convertCRtoCRLFprivate boolean__lastWasCR
-
Constructor Summary
Constructors Constructor Description TelnetOutputStream(TelnetClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream.voidflush()Flushes the stream.voidwrite(byte[] buffer)Writes a byte array to the stream.voidwrite(byte[] buffer, int offset, int length)Writes a number of bytes from a byte array to the stream starting from a given offset.voidwrite(int ch)Writes a byte to the stream.
-
-
-
Field Detail
-
__client
private final TelnetClient __client
-
__convertCRtoCRLF
private final boolean __convertCRtoCRLF
- See Also:
- Constant Field Values
-
__lastWasCR
private boolean __lastWasCR
-
-
Constructor Detail
-
TelnetOutputStream
TelnetOutputStream(TelnetClient client)
-
-
Method Detail
-
write
public void write(int ch) throws java.io.IOExceptionWrites a byte to the stream.- Specified by:
writein classjava.io.OutputStream- Parameters:
ch- The byte to write.- Throws:
java.io.IOException- If an error occurs while writing to the underlying stream.
-
write
public void write(byte[] buffer) throws java.io.IOExceptionWrites a byte array to the stream.- Overrides:
writein classjava.io.OutputStream- Parameters:
buffer- The byte array to write.- Throws:
java.io.IOException- If an error occurs while writing to the underlying stream.
-
write
public void write(byte[] buffer, int offset, int length) throws java.io.IOExceptionWrites a number of bytes from a byte array to the stream starting from a given offset.- Overrides:
writein classjava.io.OutputStream- Parameters:
buffer- The byte array to write.offset- The offset into the array at which to start copying data.length- The number of bytes to write.- Throws:
java.io.IOException- If an error occurs while writing to the underlying stream.
-
flush
public void flush() throws java.io.IOExceptionFlushes the stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-