/** * Write a single character. */ public void write(int c) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(c); } else { if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); buf.buf[buf.pos++] = (char) c; } }
/** * Terminate the current line by writing the line separator string. The * line separator string is defined by the system property * <code>line.separator</code>, and is not necessarily a single newline * character (<code>'\n'</code>). * * Need to change this from PrintWriter because the default * println() writes to the sink directly instead of through the * write method... */ public void println() throws IOException { newLine(); }
@Override public void clearBuffer() throws IOException { if (bufferSize == 0) throw new IllegalStateException( getLocalizeMessage("jsp.error.ise_on_clear")); ensureOpen(); nextChar = 0; }
this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush); } else { this.baseOut.init(response, bufferSize, autoFlush);
/** * Flush the output buffer to the underlying character stream, without * flushing the stream itself. This method is non-private only so that it * may be invoked by PrintStream. */ protected final void flushBuffer() throws IOException { if (bufferSize == 0) return; flushed = true; ensureOpen(); if (nextChar == 0) return; initOut(); out.write(cb, 0, nextChar); nextChar = 0; }
/** * Close the stream. * */ public void close() throws IOException { if (response == null || closed) // multiple calls to close is OK return; flush(); if (out != null) out.close(); out = null; closed = true; }
/** * Flush the stream. * */ public void flush() throws IOException { flushBuffer(); if (out != null) { out.flush(); } }
private void initByteOut() throws IOException { initOut(); if (byteOut == null) { try { byteOut = (ByteWriter) out; implementsByteWriter = true; } catch (ClassCastException ex) { implementsByteWriter = false; } } }
public static void main (String[] args) throws Exception { char[] buff = {'f','o','o','b','a','r','b','a','z','y'}; BodyContentImpl bodyContent = new BodyContentImpl(new JspWriterImpl(null, 100, false)); bodyContent.println (buff); System.out.println (bodyContent.getString ()); bodyContent.writeOut (new PrintWriter( new OutputStreamWriter(System.out,"UTF-8"))); }
@Override public void clearBuffer() throws IOException { if (bufferSize == 0) throw new IllegalStateException( Localizer.getMessage("jsp.error.ise_on_clear")); ensureOpen(); nextChar = 0; }
this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush); } else { this.baseOut.init(response, bufferSize, autoFlush);
public void clearBuffer() throws IOException { if (bufferSize == 0) throw new IllegalStateException( getLocalizeMessage("jsp.error.ise_on_clear")); ensureOpen(); nextChar = 0; }
/** * Flush the output buffer to the underlying character stream, without * flushing the stream itself. This method is non-private only so that it * may be invoked by PrintStream. */ protected final void flushBuffer() throws IOException { if (bufferSize == 0) return; flushed = true; ensureOpen(); if (nextChar == 0) return; initOut(); out.write(cb, 0, nextChar); nextChar = 0; }
/** * Close the stream. * */ public void close() throws IOException { if (response == null || closed) // multiple calls to close is OK return; flush(); if (out != null) out.close(); out = null; closed = true; }
/** * Flush the stream. * */ public void flush() throws IOException { flushBuffer(); if (out != null) { out.flush(); } }
private void initByteOut() throws IOException { initOut(); if (byteOut == null) { try { byteOut = (ByteWriter) out; implementsByteWriter = true; } catch (ClassCastException ex) { implementsByteWriter = false; } } }
public static void main (String[] args) throws Exception { char[] buff = {'f','o','o','b','a','r','b','a','z','y'}; BodyContentImpl bodyContent = new BodyContentImpl(new JspWriterImpl(null, 100, false)); bodyContent.println (buff); System.out.println (bodyContent.getString ()); bodyContent.writeOut (new PrintWriter( new OutputStreamWriter(System.out,"UTF-8"))); }
public void clearBuffer() throws IOException { if (bufferSize == 0) throw MESSAGES.cannotClearWithNoBuffer(); ensureOpen(); nextChar = 0; }
/** * Write a single character. */ public void write(int c) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(c); } else { if (nextChar >= bufferSize) if (autoFlush) flushBuffer(); else bufferOverflow(); cb[nextChar++] = (char) c; } }