public class InfiniteReadWriteByteBuffer extends Object implements InfiniteReadWriteByteBufferInterface
Title: CASA Agent Infrastructure
Description:
Copyright: Copyright (c) 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, University of Calgary
Modifier and Type | Field and Description |
---|---|
private byte[] |
buffer |
private int |
bytesExpected |
Constructor and Description |
---|
InfiniteReadWriteByteBuffer() |
Modifier and Type | Method and Description |
---|---|
int |
bytesAvailableInBuffer() |
int |
getBytesExpected() |
byte[] |
peakBuffer(int size) |
void |
putBytesExpected(int n)
Updates the number that will be returned by
InfiniteReadWriteByteBufferInterface.getBytesExpected() . |
byte[] |
readBuffer(int size)
Returns the first size elements from the buffer and removes them
from the buffer.
|
void |
writeBuffer(byte[] data)
Adds the data to the end of the buffer.
|
public void writeBuffer(byte[] data)
InfiniteReadWriteByteBufferInterface
InfiniteReadWriteByteBufferInterface.readBuffer(int)
.writeBuffer
in interface InfiniteReadWriteByteBufferInterface
data
- The data to be written into the end of the buffer.public byte[] readBuffer(int size)
InfiniteReadWriteByteBufferInterface
readBuffer
in interface InfiniteReadWriteByteBufferInterface
size
- Specifies the number or elements to read from the buffer.public int bytesAvailableInBuffer()
bytesAvailableInBuffer
in interface InfiniteReadWriteByteBufferInterface
public byte[] peakBuffer(int size)
peakBuffer
in interface InfiniteReadWriteByteBufferInterface
public int getBytesExpected()
getBytesExpected
in interface InfiniteReadWriteByteBufferInterface
InfiniteReadWriteByteBufferInterface.putBytesExpected(int)
.public void putBytesExpected(int n)
InfiniteReadWriteByteBufferInterface
InfiniteReadWriteByteBufferInterface.getBytesExpected()
.putBytesExpected
in interface InfiniteReadWriteByteBufferInterface
n
- The number to be returned by subsequent calls to InfiniteReadWriteByteBufferInterface.getBytesExpected()
.