public abstract class AbstractBufferManager extends Base implements ByteBufferManager
Base.LoggingWriter, Base.StackFrame| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBufferManager(int cbInitial, int cbMaximum)
Construct a AbstractBufferManager that supports a buffer of a certain initial and maximum size.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
allocateBuffer()
Allocate a new buffer, copying old data if there is any.
|
protected void |
calibrate()
Determine the grow and shrink thresholds based on the current capacity.
|
ByteBuffer |
getBuffer()
Get the current ByteBuffer reference.
|
int |
getCapacity()
Get the capacity of the current ByteBuffer.
|
int |
getGrowthThreshold()
Determine the level (what number of bytes used) above which the current ByteBuffer will need to be "resized" upwards.
|
int |
getMaxCapacity()
Determine the maximum size that the managed buffer can reach.
|
protected int |
getMaxIncrement() |
int |
getMinCapacity()
Determine the minimum size that the managed buffer can reach.
|
int |
getShrinkageThreshold()
Determine the level (what number of bytes used) below which the current ByteBuffer will need to be "resized" downwards.
|
void |
grow(int cbRequired)
Request that the buffer be grown based on the number of bytes currently required.
|
protected void |
setBuffer(ByteBuffer buffer)
Set the current ByteBuffer reference.
|
protected void |
setCapacity(int cb)
Set the capacity of the current ByteBuffer.
|
protected void |
setGrowthThreshold(int cb)
Specify the level (what number of bytes used) above which the current ByteBuffer will need to be "resized" upwards.
|
protected void |
setMaxCapacity(int cb)
Specify the maximum size that the managed buffer can reach.
|
protected void |
setMinCapacity(int cb)
Specify the minimum size that the managed buffer can reach.
|
protected void |
setShrinkageThreshold(int cb)
Specify the level (what number of bytes used) below which the current ByteBuffer will need to be "resized" downwards.
|
void |
shrink(int cbRequired)
Request that the buffer be shrunk based on the number of bytes currently required.
|
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
protected AbstractBufferManager(int cbInitial,
int cbMaximum)
cbInitial - the initial sizecbMaximum - the maximum sizepublic ByteBuffer getBuffer()
getBuffer in interface ByteBufferManagerprotected void setBuffer(ByteBuffer buffer)
buffer - the current ByteBufferpublic int getCapacity()
getBuffer().capacity().getCapacity in interface ByteBufferManagerprotected void setCapacity(int cb)
cb - the capacity of the managed ByteBufferpublic int getGrowthThreshold()
getGrowthThreshold in interface ByteBufferManagerprotected void setGrowthThreshold(int cb)
cb - the number of bytes that, when the number of used bytes exceeds it, the ByteBuffer will need to growpublic int getShrinkageThreshold()
getShrinkageThreshold in interface ByteBufferManagerprotected void setShrinkageThreshold(int cb)
cb - the number of bytes that, when the number of used bytes drops below it, the ByteBuffer will need to shrinkpublic int getMinCapacity()
getCapacity.getMinCapacity in interface ByteBufferManagerprotected void setMinCapacity(int cb)
cb - minimum size for the managed bufferpublic int getMaxCapacity()
getCapacity.getMaxCapacity in interface ByteBufferManagerprotected void setMaxCapacity(int cb)
cb - maximum size for the managed bufferprotected int getMaxIncrement()
public void grow(int cbRequired)
grow in interface ByteBufferManagercbRequired - the number of bytes that are needed by the requesting operationpublic void shrink(int cbRequired)
shrink in interface ByteBufferManagercbRequired - the number of contiguous bytes in the buffer, starting from offset 0, that are actually in useprotected void calibrate()
protected abstract void allocateBuffer()