public class BlockingInputStream
extends java.io.InputStream
| 限定符和类型 | 字段和说明 |
|---|---|
protected byte[] |
buf
The transfer buffer
|
protected boolean |
closed
Set to true when
close() is called |
protected java.util.concurrent.locks.Lock |
lock |
protected java.util.concurrent.locks.Condition |
not_empty
Signalled when the buf becomes 'readable'; ie. is not empty anymore
|
protected java.util.concurrent.locks.Condition |
not_full
Signalled when the buf becomes 'writeable'; ie. is not full anymore
|
protected int |
read_pos
Index into buf at which the next bytes will be read.
|
protected int |
write_pos
Index into buf at which bytes will be written.
|
| 构造器和说明 |
|---|
BlockingInputStream() |
BlockingInputStream(int capacity) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
available() |
int |
capacity() |
void |
close()
Closes the stream.
|
protected void |
compact()
Moves the bytes between [read_pos and write_pos] read_pos bytes to the left, such that the new read_pos is 0
and the write_pos is write_pos - read_pos.
|
boolean |
isClosed() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
protected int |
remaining() |
protected static void |
sanityCheck(byte[] buf,
int offset,
int length)
Verifies that length doesn't exceed a buffer's length
|
protected int |
size() |
long |
skip(long n) |
java.lang.String |
toString() |
void |
write(byte[] buf)
Appends bytes to the end of the stream
|
void |
write(byte[] buf,
int offset,
int length)
Appends bytes to the end of the stream.
|
protected boolean closed
close() is calledprotected final byte[] buf
protected int read_pos
protected int write_pos
protected final java.util.concurrent.locks.Lock lock
protected final java.util.concurrent.locks.Condition not_full
protected final java.util.concurrent.locks.Condition not_empty
public BlockingInputStream()
public BlockingInputStream(int capacity)
public int read()
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionpublic void write(byte[] buf)
throws java.io.IOException
buf - java.io.IOExceptionwrite(byte[], int, int)public void write(byte[] buf,
int offset,
int length)
throws java.io.IOException
buf - The buffer to be added to the end of the streamoffset - The offset within buf at which bytes are readlength - The number of bytes to be addedjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip 在类中 java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available 在类中 java.io.InputStreamjava.io.IOExceptionpublic int capacity()
public void close()
throws java.io.IOException
close 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableclose 在类中 java.io.InputStreamjava.io.IOExceptionpublic boolean isClosed()
public java.lang.String toString()
toString 在类中 java.lang.Objectprotected int size()
protected int remaining()
protected void compact()
protected static void sanityCheck(byte[] buf,
int offset,
int length)
buf - offset - length -