/** * @see java.io.CharArrayWriter#toCharArray() */ public char[] toCharArray() { return buffer.toArray(); }
/** * Appends single <code>short</code> to buffer. */ public FastShortBuffer append(short element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Appends single <code>byte</code> to buffer. */ public FastByteBuffer append(byte element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Writes single byte. */ @Override public void write(int b) { buffer.append((char) b); }
/** * Writes single byte. */ @Override public void write(int b) { buffer.append((byte) b); }
/** * Appends single <code>int</code> to buffer. */ public FastIntBuffer append(int element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Adds element to buffer. */ public void add(E element) { append(element); }
/** * Appends <code>float</code> array to buffer. */ public FastFloatBuffer append(float[] array) { return append(array, 0, array.length); }
/** * Appends <code>short</code> array to buffer. */ public FastShortBuffer append(short[] array) { return append(array, 0, array.length); }
/** * Appends <code>boolean</code> array to buffer. */ public FastBooleanBuffer append(boolean[] array) { return append(array, 0, array.length); }
/** * Appends single <code>boolean</code> to buffer. */ public FastBooleanBuffer append(boolean element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Appends <code>double</code> array to buffer. */ public FastDoubleBuffer append(double[] array) { return append(array, 0, array.length); }
/** * Appends single <code>char</code> to buffer. */ public FastCharBuffer append(char element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Appends single <code>float</code> to buffer. */ public FastFloatBuffer append(float element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * Appends single <code>long</code> to buffer. */ public FastLongBuffer append(long element) { if ((currentBuffer == null) || (offset == currentBuffer.length)) { needNewBuffer(size + 1); } currentBuffer[offset] = element; offset++; size++; return this; }
/** * @see java.io.ByteArrayOutputStream#reset() */ public void reset() { buffer.clear(); }
/** * @see java.io.CharArrayWriter#reset() */ public void reset() { buffer.clear(); }
/** * Creates a new byte array output stream, with a buffer capacity of * the specified size, in bytes. * * @param size the initial size. * @throws IllegalArgumentException if size is negative. */ public FastByteArrayOutputStream(int size) { buffer = new FastByteBuffer(size); }
/** * Creates a new char array writer, with a buffer capacity of * the specified size, in bytes. * * @param size the initial size. * @throws IllegalArgumentException if size is negative. */ public FastCharArrayWriter(int size) { buffer = new FastCharBuffer(size); }
/** * @see java.io.ByteArrayOutputStream#toByteArray() */ public byte[] toByteArray() { return buffer.toArray(); }