Lines Matching refs:buffer

39      * The circular buffer through which data is passed. Data is read from the
41 * Data in the buffer is either sequential: <pre>
46 * ...or wrapped around the buffer's end: <pre>
51 * When the buffer is empty, {@code in == -1}. Reading when the buffer is
52 * empty will block until data is available. When the buffer is full,
53 * {@code in == out}. Writing when the buffer is full will block until free
56 private char[] buffer;
59 * The index in {@code buffer} where the next character will be written.
64 * The index in {@code buffer} where the next character will be read.
100 * Constructs a new unconnected {@code PipedReader} with the given buffer size.
104 * @param pipeSize the size of the buffer in chars.
112 buffer = new char[pipeSize];
117 * with the given buffer size. Any data written to the writer can be read from
121 * @param pipeSize the size of the buffer in chars.
132 * Closes this reader. This implementation releases the buffer used for
140 buffer = null;
172 if (buffer == null) { // We may already have allocated the buffer.
173 buffer = new char[PIPE_SIZE];
203 * in the character array {@code buffer} starting at {@code offset}. If
216 * if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
224 @Override public synchronized int read(char[] buffer, int offset, int count) throws IOException {
228 if (this.buffer == null) {
231 Arrays.checkOffsetAndCount(buffer.length, offset, count);
261 /* Copy chars from out to end of buffer first */
263 copyLength = count > this.buffer.length - out ? this.buffer.length - out : count;
264 System.arraycopy(this.buffer, out, buffer, offset, copyLength);
266 if (out == this.buffer.length) {
270 // empty buffer
277 * Did the read fully succeed in the previous copy or is the buffer
287 System.arraycopy(this.buffer, out, buffer, offset + charsCopied, copyLength);
290 // empty buffer
301 * implementation returns {@code true} if the internal buffer contains
316 if (buffer == null) {
326 * If the buffer is full and the thread sending #receive is interrupted, the
337 if (buffer == null) {
350 while (buffer != null && out == in) {
360 if (buffer == null) {
366 buffer[in++] = oneChar;
367 if (in == buffer.length) {
376 * If the buffer is full and the thread sending #receive is interrupted, the
385 if (buffer == null) {
399 while (buffer != null && out == in) {
409 if (buffer == null) {
416 int length = buffer.length - in;
420 System.arraycopy(chars, offset, buffer, in, length);
424 if (in == buffer.length) {
433 System.arraycopy(chars, offset, buffer, in, length);