Top Description Fields Constructors Methods
org.xnio.streams

public final Class Pipe

extends Object
Class Inheritance
Static Imports
org.xnio._private.Messages.msg

An in-VM pipe between an input stream and an output stream, which does not suffer from the bugs in PipedInputStream.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final byte[]
private final InputStream
private final Object
private final OutputStream
private boolean
private int
size

the size of the buffer content

private int
tail

the point at which a read shall occur

private boolean

Constructor Summary

AccessConstructor and Description
public
Pipe(int
the buffer size to use
bufferSize
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
await()

Wait for the read side to close.

public InputStream

Returns:

the input side
getIn
()

Get the input (read) side of the pipe.

public OutputStream

Returns:

the output side
getOut
()

Get the output (write) side of the pipe.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final byte[] buffer
inback to summary
private final InputStream in
lockback to summary
private final Object lock
outback to summary
private final OutputStream out
readClosedback to summary
private boolean readClosed
sizeback to summary
private int size

the size of the buffer content

tailback to summary
private int tail

the point at which a read shall occur

writeClosedback to summary
private boolean writeClosed

Constructor Detail

Pipeback to summary
public Pipe(int bufferSize)

Construct a new instance.

Parameters
bufferSize:int

the buffer size to use

Method Detail

awaitback to summary
public void await()

Wait for the read side to close. Used when the writer needs to know when the reader finishes consuming a message.

getInback to summary
public InputStream getIn()

Get the input (read) side of the pipe.

Returns:InputStream

the input side

getOutback to summary
public OutputStream getOut()

Get the output (write) side of the pipe.

Returns:OutputStream

the output side