public class CircularCharArrayBuffer extends Object
size() (it will never be larger
than the buffer size). The characters present in the buffer are provided through the toCharArray(char[], int, int)
method and alike.| Constructor and Description |
|---|
CircularCharArrayBuffer(int maxChar)
Creates a new circular buffer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(char[] b,
int offset,
int length)
Adds the characters
b[offset], … b[offset+length-1] to the
buffer (possibly just the last ones, and possibly discarding the oldest characters in the buffer). |
void |
clear()
Clears the buffer content, before reuse.
|
int |
size()
The number of characters present in the buffer.
|
char[] |
toCharArray()
Returns a new array containing a copy of the buffer content.
|
void |
toCharArray(char[] b)
Copies the content of the buffer to an array.
|
void |
toCharArray(char[] b,
int offset,
int length)
Copies the content of the buffer to an array.
|
public CircularCharArrayBuffer(int maxChar)
maxChar - the buffer size.public void add(char[] b,
int offset,
int length)
b[offset], … b[offset+length-1] to the
buffer (possibly just the last ones, and possibly discarding the oldest characters in the buffer).b - the array whence characters are copied.offset - the starting point.length - the (maximum) number of characters to be copied.public void toCharArray(char[] b,
int offset,
int length)
b - the buffer where the content is to be copied.offset - the starting index where copy should start from.length - the maximum number of characters to be copied.public void toCharArray(char[] b)
b - the buffer where the content is to be copied.public char[] toCharArray()
public int size()
public void clear()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.