private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes {@code count} characters starting at {@code offset} in {@code buf} * to this writer. The characters are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * as a result of the conversion, this writer is flushed. * * @param buffer * the array containing characters to write. * @param offset * the index of the first character in {@code buf} to write. * @param count * the maximum number of characters to write. * @throws IndexOutOfBoundsException * if {@code offset < 0} or {@code count < 0}, or if * {@code offset + count} is greater than the size of * {@code buf}. * @throws IOException * if this writer has already been closed or another I/O error * occurs. */ @Override public void write(char[] buffer, int offset, int count) throws IOException { synchronized (lock) { checkStatus(); Arrays.checkOffsetAndCount(buffer.length, offset, count); CharBuffer chars = CharBuffer.wrap(buffer, offset, count); convert(chars); } }
throw new StringIndexOutOfBoundsException(str, offset, count); checkStatus(); CharBuffer chars = CharBuffer.wrap(str, offset, count + offset); convert(chars);
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
private void flushBytes(boolean flushUnderlyingStream) throws IOException { synchronized (lock) { checkStatus(); int position = bytes.position(); if (position > 0) { bytes.flip(); out.write(bytes.array(), bytes.arrayOffset(), position); bytes.clear(); } if (flushUnderlyingStream) { out.flush(); } } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar the character to write. * @throws IOException if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[]{(char) oneChar}); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes the character {@code oneChar} to this writer. The lowest two bytes * of the integer {@code oneChar} are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * by converting this character, this writer is flushed. * * @param oneChar * the character to write. * @throws IOException * if this writer is closed or another I/O error occurs. */ @Override public void write(int oneChar) throws IOException { synchronized (lock) { checkStatus(); CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar }); convert(chars); } }
/** * Writes {@code count} characters starting at {@code offset} in {@code buf} * to this writer. The characters are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * as a result of the conversion, this writer is flushed. * * @param buffer the array containing characters to write. * @param offset the index of the first character in {@code buf} to write. * @param count the maximum number of characters to write. * @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if * {@code offset + count} is greater than the size of * {@code buf}. * @throws IOException if this writer has already been closed or another I/O error * occurs. */ @Override public void write(char[] buffer, int offset, int count) throws IOException { synchronized (lock) { checkStatus(); JTranscArrays.checkOffsetAndCount(buffer.length, offset, count); CharBuffer chars = CharBuffer.wrap(buffer, offset, count); convert(chars); } }
/** * Writes {@code count} characters starting at {@code offset} in {@code buf} * to this writer. The characters are immediately converted to bytes by the * character converter and stored in a local buffer. If the buffer gets full * as a result of the conversion, this writer is flushed. * * @param buffer * the array containing characters to write. * @param offset * the index of the first character in {@code buf} to write. * @param count * the maximum number of characters to write. * @throws IndexOutOfBoundsException * if {@code offset < 0} or {@code count < 0}, or if * {@code offset + count} is greater than the size of * {@code buf}. * @throws IOException * if this writer has already been closed or another I/O error * occurs. */ @Override public void write(char[] buffer, int offset, int count) throws IOException { synchronized (lock) { checkStatus(); Arrays.checkOffsetAndCount(buffer.length, offset, count); CharBuffer chars = CharBuffer.wrap(buffer, offset, count); convert(chars); } }