/** * Flush the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#flush()} will be called. * @throws IOException if an I/O error occurs */ @Override public void flush() throws IOException { flushOutput(); writer.flush(); }
/** * Close the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#close()} will be called. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { processInput(true); flushOutput(); writer.close(); }
/** * Decode the contents of the input ByteBuffer into a CharBuffer. * * @param endOfInput indicates end of input * @throws IOException if an I/O error occurs */ private void processInput(final boolean endOfInput) throws IOException { // Prepare decoderIn for reading decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { // The decoder is configured to replace malformed input and unmappable characters, // so we should not get here. throw new IOException("Unexpected coder result"); } } // Discard the bytes that have been read decoderIn.compact(); }
/** * Write bytes from the specified byte array to the stream. * * @param b the byte array containing the bytes to write * @param off the start offset in the byte array * @param len the number of bytes to write * @throws IOException if an I/O error occurs */ @Override public void write(final byte[] b, int off, int len) throws IOException { while (len > 0) { final int c = Math.min(len, decoderIn.remaining()); decoderIn.put(b, off, c); processInput(false); len -= c; off += c; } if (writeImmediately) { flushOutput(); } }
/** * Flush the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#flush()} will be called. * @throws IOException if an I/O error occurs */ @Override public void flush() throws IOException { flushOutput(); writer.flush(); }
/** * Flush the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#flush()} will be called. * @throws IOException if an I/O error occurs */ @Override public void flush() throws IOException { flushOutput(); writer.flush(); }
/** * Flush the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#flush()} will be called. * @throws IOException if an I/O error occurs */ @Override public void flush() throws IOException { flushOutput(); writer.flush(); }
/** * Flush the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#flush()} will be called. * @throws IOException if an I/O error occurs */ @Override public void flush() throws IOException { flushOutput(); writer.flush(); }
/** * Close the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#close()} will be called. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { processInput(true); flushOutput(); writer.close(); }
/** * Close the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#close()} will be called. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { processInput(true); flushOutput(); writer.close(); }
/** * Close the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#close()} will be called. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { processInput(true); flushOutput(); writer.close(); }
/** * Close the stream. Any remaining content accumulated in the output buffer * will be written to the underlying {@link Writer}. After that * {@link Writer#close()} will be called. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { processInput(true); flushOutput(); writer.close(); }
/** * Decode the contents of the input ByteBuffer into a CharBuffer. * * @param endOfInput indicates end of input * @throws IOException if an I/O error occurs */ private void processInput(final boolean endOfInput) throws IOException { // Prepare decoderIn for reading decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { // The decoder is configured to replace malformed input and unmappable characters, // so we should not get here. throw new IOException("Unexpected coder result"); } } // Discard the bytes that have been read decoderIn.compact(); }
/** * Decode the contents of the input ByteBuffer into a CharBuffer. * * @param endOfInput indicates end of input * @throws IOException if an I/O error occurs */ private void processInput(boolean endOfInput) throws IOException { // Prepare decoderIn for reading decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { // The decoder is configured to replace malformed input and unmappable characters, // so we should not get here. throw new IOException("Unexpected coder result"); } } // Discard the bytes that have been read decoderIn.compact(); }
/** * Decode the contents of the input ByteBuffer into a CharBuffer. * * @param endOfInput indicates end of input * @throws IOException if an I/O error occurs */ private void processInput(final boolean endOfInput) throws IOException { // Prepare decoderIn for reading decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { // The decoder is configured to replace malformed input and unmappable characters, // so we should not get here. throw new IOException("Unexpected coder result"); } } // Discard the bytes that have been read decoderIn.compact(); }
/** * Decode the contents of the input ByteBuffer into a CharBuffer. * * @param endOfInput indicates end of input * @throws IOException if an I/O error occurs */ private void processInput(boolean endOfInput) throws IOException { // Prepare decoderIn for reading decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { // The decoder is configured to replace malformed input and unmappable characters, // so we should not get here. throw new IOException("Unexpected coder result"); } } // Discard the bytes that have been read decoderIn.compact(); }
/** * Write bytes from the specified byte array to the stream. * * @param b the byte array containing the bytes to write * @param off the start offset in the byte array * @param len the number of bytes to write * @throws IOException if an I/O error occurs */ @Override public void write(final byte[] b, int off, int len) throws IOException { while (len > 0) { final int c = Math.min(len, decoderIn.remaining()); decoderIn.put(b, off, c); processInput(false); len -= c; off += c; } if (writeImmediately) { flushOutput(); } }
/** * Write bytes from the specified byte array to the stream. * * @param b the byte array containing the bytes to write * @param off the start offset in the byte array * @param len the number of bytes to write * @throws IOException if an I/O error occurs */ @Override public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int c = Math.min(len, decoderIn.remaining()); decoderIn.put(b, off, c); processInput(false); len -= c; off += c; } if (writeImmediately) { flushOutput(); } }
/** * Write bytes from the specified byte array to the stream. * * @param b the byte array containing the bytes to write * @param off the start offset in the byte array * @param len the number of bytes to write * @throws IOException if an I/O error occurs */ @Override public void write(final byte[] b, int off, int len) throws IOException { while (len > 0) { final int c = Math.min(len, decoderIn.remaining()); decoderIn.put(b, off, c); processInput(false); len -= c; off += c; } if (writeImmediately) { flushOutput(); } }
/** * Write bytes from the specified byte array to the stream. * * @param b the byte array containing the bytes to write * @param off the start offset in the byte array * @param len the number of bytes to write * @throws IOException if an I/O error occurs */ @Override public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int c = Math.min(len, decoderIn.remaining()); decoderIn.put(b, off, c); processInput(false); len -= c; off += c; } if (writeImmediately) { flushOutput(); } }