public void clearBuffer() throws IOException { if (writer == null) { clear(); } }
/** * Sets the writer to which all output is written. */ void setWriter(Writer writer) { this.writer = writer; closed = false; if (writer == null) { clearBody(); } }
/** * 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>). * * @throws IOException Error writing to wrapped writer */ @Override public void println() throws IOException { newLine(); }
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 (System.out)); }
@Override public JspWriter pushBody(Writer writer) { depth++; if (depth >= outs.length) { BodyContentImpl[] newOuts = Arrays.copyOf(outs, depth + 1); newOuts[depth] = new BodyContentImpl(out); outs = newOuts; } outs[depth].setWriter(writer); out = outs[depth]; // Update the value of the "out" attribute in the page scope // attribute namespace of this PageContext setAttribute(OUT, out); return outs[depth]; }
/** * Write a single character. */ public void write(int c) throws IOException { if (writer != null) { writer.write(c); } else { ensureOpen(); if (nextChar >= bufferSize) { reAllocBuff (1); } cb[nextChar++] = (char) c; } }
/** * Write an array of characters. This method cannot be inherited from the * Writer class because it must suppress I/O exceptions. */ @Override public void write(char[] buf) throws IOException { if (writer != null) { writer.write(buf); } else { write(buf, 0, buf.length); } }
public void write(int i) throws IOException { if (writer != null) { writer.write(i); } else { ensureOpen(); buffer.buffer((char) i); } }
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 (System.out)); }
public JspWriter pushBody(Writer writer) { depth++; if (depth >= outs.length) { BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1]; for (int i=0; i<outs.length; i++) { newOuts[i] = outs[i]; } newOuts[depth] = new BodyContentImpl(out); outs = newOuts; } outs[depth].setWriter(writer); out = outs[depth]; // Update the value of the "out" attribute in the page scope // attribute namespace of this PageContext setAttribute(OUT, out); return outs[depth]; }
/** * Write a single character. */ public void write(int c) throws IOException { if (writer != null) { writer.write(c); } else { ensureOpen(); if (nextChar >= bufferSize) { reAllocBuff (1); } cb[nextChar++] = (char) c; } }
public void print(char ac[]) throws IOException { if (writer != null) { writer.write(ac); } else { write(ac); } }
public void write(int i) throws IOException { if (writer != null) { writer.write(i); } else { ensureOpen(); buffer.buffer((char) i); } }
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 (System.out)); }
public JspWriter pushBody(Writer writer) { depth++; if (depth >= outs.length) { BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1]; for (int i=0; i<outs.length; i++) { newOuts[i] = outs[i]; } newOuts[depth] = new BodyContentImpl(out); outs = newOuts; } outs[depth].setWriter(writer); out = outs[depth]; // Update the value of the "out" attribute in the page scope // attribute namespace of this PageContext setAttribute(OUT, out); return outs[depth]; }
/** * Write a single character. */ public void write(int c) throws IOException { if (writer != null) { writer.write(c); } else { ensureOpen(); if (nextChar >= bufferSize) { reAllocBuff (1); } cb[nextChar++] = (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>). * * @throws IOException */ @Override public void println() throws IOException { newLine(); }