public class DynamicBuffer extends Object
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf
The buffer
|
protected static int |
DEFAULT_BUFFER_SIZE
Buffer size when the dynamic buffer is opened
|
protected InputStream |
in
This buffers InputStream
|
protected OutputStream |
out
This buffers OutputStream
|
protected int |
readpos
The current read position
|
protected int |
writepos
The current write position
|
Constructor and Description |
---|
DynamicBuffer()
Creates a new DynamicBuffer object.
|
Modifier and Type | Method and Description |
---|---|
protected int |
available()
Return the number of bytes of data available to be read from the buffer
|
void |
close()
Closes the buffer
|
protected void |
flush()
Flush data
|
InputStream |
getInputStream()
Get the InputStream of this buffer.
|
OutputStream |
getOutputStream()
Get the OutputStream of the buffer.
|
protected int |
read()
Read a byte from the buffer
|
protected int |
read(byte[] data,
int offset,
int len)
Read a byte array from the buffer
|
void |
setBlockInterrupt(int interrupt) |
protected void |
write(byte[] data,
int offset,
int len) |
protected void |
write(int b)
Write a byte array to the buffer
|
protected static final int DEFAULT_BUFFER_SIZE
protected byte[] buf
protected int writepos
protected int readpos
protected InputStream in
protected OutputStream out
public InputStream getInputStream()
public OutputStream getOutputStream()
protected int available()
public void close()
protected void write(int b) throws IOException
b
- IOException
protected void write(byte[] data, int offset, int len) throws IOException
data
- offset
- len
- IOException
public void setBlockInterrupt(int interrupt)
protected int read() throws IOException
IOException
InterruptedIOException
protected int read(byte[] data, int offset, int len) throws IOException
data
- offset
- len
- IOException
InterruptedIOException
protected void flush() throws IOException
IOException
Copyright © 2016. All rights reserved.