public final class MemoryClearingBuffer extends Object
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
computedBytes |
private char[] |
computedChars |
private byte[] |
originalBytes |
private char[] |
originalChars |
private char[] |
precomputedChars |
| Modifier | Constructor and Description |
|---|---|
private |
MemoryClearingBuffer(byte[] originalBytes,
char[] originalChars,
boolean trim,
boolean lowerCase) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the buffer out, filling its cells with null.
|
byte[] |
getBytes()
Returns the
byte[] used to create this buffer, or
getComputedBytes() if created with a char[]. |
char[] |
getChars()
Returns the
char[] used to create this buffer, or
getComputedChars() if created with a byte[]. |
(package private) byte[] |
getComputedBytes()
Returns a UTF8 encoded
byte[] representation of the
char[] used to create this buffer. |
private char[] |
getComputedChars()
Returns a UTF8 decoded
char[] representation of the
byte[] used to create this buffer. |
static MemoryClearingBuffer |
newInstance(byte[] bytes)
Creates a new instance of MemoryClearingBuffer from a
byte[]. |
static MemoryClearingBuffer |
newInstance(char[] chars)
Creates a new instance of MemoryClearingBuffer from a
char[]. |
static MemoryClearingBuffer |
newInstance(char[] chars,
boolean trim,
boolean lowerCase)
Creates a new instance of MemoryClearingBuffer from a
char[], optionally performing whitespace trimming and
conversion to lower case. |
private byte[] computedBytes
private char[] computedChars
private byte[] originalBytes
private char[] originalChars
private char[] precomputedChars
private MemoryClearingBuffer(byte[] originalBytes,
char[] originalChars,
boolean trim,
boolean lowerCase)
public static MemoryClearingBuffer newInstance(byte[] bytes)
byte[].bytes - A byte[]public static MemoryClearingBuffer newInstance(char[] chars)
char[].chars - A char[]public static MemoryClearingBuffer newInstance(char[] chars, boolean trim, boolean lowerCase)
char[], optionally performing whitespace trimming and
conversion to lower case.chars - A char[]trim - If true, whitespace will be trimmed off of both ends of the
char[]lowerCase - If true, the characters will be converted to lower casepublic void clear()
byte[] getComputedBytes()
byte[] representation of the
char[] used to create this buffer.private char[] getComputedChars()
char[] representation of the
byte[] used to create this buffer.public byte[] getBytes()
byte[] used to create this buffer, or
getComputedBytes() if created with a char[].public char[] getChars()
char[] used to create this buffer, or
getComputedChars() if created with a byte[].Copyright © 2009–2019 The Apache Software Foundation. All rights reserved.