de.unkrig.commons.io.pipe
Interface Pipe

All Superinterfaces:
java.io.Closeable
All Known Implementing Classes:
AbstractPipe, AbstractRingBuffer

public interface Pipe
extends java.io.Closeable

read(byte[], int, int) produces exactly the bytes that were previously written.


Method Summary
 void close()
          Releases any resources allocated for this pipe.
 boolean isEmpty()
           
 boolean isFull()
           
 int read(byte[] buf, int off, int len)
           
 int write(byte[] buf, int off, int len)
           
 

Method Detail

read

int read(byte[] buf,
         int off,
         int len)
         throws java.io.IOException
Returns:
The number of bytes read; 0 iff the pipe is empty
Throws:
java.io.IOException

write

int write(byte[] buf,
          int off,
          int len)
          throws java.io.IOException
Returns:
The number of bytes written; 0 iff the pipe is full
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Releases any resources allocated for this pipe. The results of subsequent invocations of read(byte[], int, int) and write(byte[], int, int) are undefined.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

isFull

boolean isFull()
Returns:
Whether the next invocation of write(byte[], int, int) will return 0

isEmpty

boolean isEmpty()
Returns:
Whether the next invocation of read(byte[], int, int) will return 0