public class ByteArrayIOStream extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ByteArrayIOStream.InputStreamImpl
Byte array InputStream.
|
static class |
ByteArrayIOStream.OutputStreamImpl
Byte array OutputStream.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.nio.ByteBuffer |
byteBuffer
Internal
ByteBuffer wrapper of internal byte array. |
protected byte[] |
bytes
Internal byte array.
|
static int |
DEFAULT_BUFFER_SIZE
Default buffer size if none specified.
|
protected int |
limit
Current
ByteBuffer limit. |
protected java.util.concurrent.Semaphore |
lock
Buffer lock.
|
| Constructor and Description |
|---|
ByteArrayIOStream()
Construct object with default buffer size.
|
ByteArrayIOStream(int bufferSize)
Construct object with supplied buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
getByteBuffer()
Return internal byte array wrapped in a new
ByteBuffer object. |
byte[] |
getBytes()
Return internal byte array.
|
java.io.InputStream |
getInputStream()
Return
InputStream and lock this buffer |
int |
getLength()
Return allocated length of internal buffer.
|
int |
getLimit()
Return internal
ByteBuffer limit. |
java.io.OutputStream |
getOutputStream()
Return
OutputStream and lock this buffer |
protected void |
release()
Release lock, called when input/output stream is closed.
|
public static final int DEFAULT_BUFFER_SIZE
protected java.util.concurrent.Semaphore lock
protected byte[] bytes
protected java.nio.ByteBuffer byteBuffer
ByteBuffer wrapper of internal byte array.protected int limit
ByteBuffer limit.public ByteArrayIOStream()
public ByteArrayIOStream(int bufferSize)
bufferSize - buffer size to usepublic java.io.OutputStream getOutputStream()
OutputStream and lock this bufferOutputStream wrapper of this bufferpublic byte[] getBytes()
public int getLength()
public int getLimit()
ByteBuffer limit.ByteBuffer limitpublic java.nio.ByteBuffer getByteBuffer()
ByteBuffer object.ByteBuffer objectpublic java.io.InputStream getInputStream()
InputStream and lock this bufferInputStream wrapper of this bufferprotected void release()
Copyright © 2011–2023. All rights reserved.