Top Description Fields Constructors Methods
org.apache.sshd.server.shell

public Class TtyFilterInputStream

extends FilterInputStream
Class Inheritance
Imports
java.io.FilterInputStream, .IOException, .InputStream, java.util.Collection, .Collections, .EnumSet, .Map, .Objects, .Set, org.apache.sshd.common.channel.PtyMode, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.buffer.Buffer, .ByteArrayBuffer

Handles the input while taking into account the PtyModes for handling CR / LF
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private Buffer
public static final Set<PtyMode>
private int
private final Set<PtyMode>
Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public synchronized int
available()

Overrides java.io.FilterInputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

protected int
protected int
protected Buffer
insertCharacter(Buffer org, int c)

public synchronized int
read()

Overrides java.io.FilterInputStream.read.

Reads the next byte of data from the input stream.

public synchronized int
read(byte[]
the buffer into which the data is read.
b
,
int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.FilterInputStream.read.

Reads up to len bytes of data from this input stream into an array of bytes.

protected int
public synchronized void
write(int c)

public synchronized void
write(byte[] buf, int off, int len)

Inherited from java.io.FilterInputStream:
closemarkmarkSupportedreadresetskip

Field Detail

bufferback to summary
private Buffer buffer
INPUT_OPTIONSback to summary
public static final Set<PtyMode> INPUT_OPTIONS
lastCharback to summary
private int lastChar
ttyOptionsback to summary
private final Set<PtyMode> ttyOptions

Constructor Detail

TtyFilterInputStreamback to summary
public TtyFilterInputStream(InputStream in, Map<PtyMode, ?> modes)
TtyFilterInputStreamback to summary
public TtyFilterInputStream(InputStream in, Collection<PtyMode> ttyOptions)

Method Detail

availableback to summary
public synchronized int available() throws IOException

Overrides java.io.FilterInputStream.available.

Doc from java.io.FilterInputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

Returns:int

an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
handleCRback to summary
protected int handleCR() throws IOException
handleLFback to summary
protected int handleLF() throws IOException
insertCharacterback to summary
protected Buffer insertCharacter(Buffer org, int c)
readback to summary
public synchronized int read() throws IOException

Overrides java.io.FilterInputStream.read.

Doc from java.io.FilterInputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public synchronized int read(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterInputStream.read.

Doc from java.io.FilterInputStream.read.

Reads up to len bytes of data from this input stream into an array of bytes. If len is not zero, the method blocks until some input is available; otherwise, no bytes are read and 0 is returned.

Parameters
b:byte[]

the buffer into which the data is read.

off:int

the start offset in array b at which the data is written.

len:int

the maximum number of bytes to read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readRawInputback to summary
protected int readRawInput() throws IOException
writeback to summary
public synchronized void write(int c)
writeback to summary
public synchronized void write(byte[] buf, int off, int len)