📄 pi3jspwriter.java
字号:
internalWrite(String.valueOf(d));
}
/**
* Print an array of characters. The characters are converted into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* method.
*
* @param s The array of chars to be printed
*
* @throws NullPointerException If <code>s</code> is <code>null</code>
* @throws java.io.IOException
*/
public void print(char s[]) throws IOException {
internalWrite(String.valueOf(s));
}
/**
* Print a string. If the argument is <code>null</code> then the string
* <code>"null"</code> is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
*
* @param s The <code>String</code> to be printed
* @throws java.io.IOException
*/
public void print(String s) throws IOException {
internalWrite(String.valueOf(s));
}
/**
* Print an object. The string produced by the <code>{@link
* java.lang.String#valueOf(Object)}</code> method is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* method.
*
* @param obj The <code>Object</code> to be printed
* @see java.lang.Object#toString()
* @throws java.io.IOException
*/
public void print(Object obj) throws IOException {
internalWrite(String.valueOf(obj));
}
/**
* 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 java.io.IOException
*/
public void println() throws IOException {
newLine();
}
/**
* Print a boolean value and then terminate the line. This method behaves
* as though it invokes <code>{@link #print(boolean)}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(boolean x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print a character and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(char)}</code> and then <code>{@link
* #println()}</code>.
* @throws java.io.IOException
*/
public void println(char x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print an integer and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(int)}</code> and then <code>{@link
* #println()}</code>.
* @throws java.io.IOException
*/
public void println(int x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print a long integer and then terminate the line. This method behaves
* as though it invokes <code>{@link #print(long)}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(long x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print a floating-point number and then terminate the line. This method
* behaves as though it invokes <code>{@link #print(float)}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(float x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print a double-precision floating-point number and then terminate the
* line. This method behaves as though it invokes <code>{@link
* #print(double)}</code> and then <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(double x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print an array of characters and then terminate the line. This method
* behaves as though it invokes <code>{@link #print(char[])}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(char x[]) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print a String and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(String x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Print an Object and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(Object)}</code> and then
* <code>{@link #println()}</code>.
* @throws java.io.IOException
*/
public void println(Object x) throws IOException {
internalWriteln(String.valueOf(x));
}
/**
* Clear the contents of the buffer. If the buffer has been already
* been flushed then the clear operation shall throw an IOException
* to signal the fact that some data has already been irrevocably
* written to the client response stream.
*
* @throws IOException If an I/O error occurs
*/
public void clear() throws IOException {
if (os == null) return;
if (os.isFlushed()) {
IOException e = new IOException("Buffer already flushed");
throw e;
} else {
os.resetBuffer();
}
}
/**
* Clears the current contents of the buffer. Unlike clear(), this
* method will not throw an IOException if the buffer has already been
* flushed. It merely clears the current content of the buffer and
* returns.
*
* @throws IOException If an I/O error occurs
*/
public void clearBuffer() throws IOException {
if (os != null) os.resetBuffer();
}
/**
* Flush the stream. If the stream has saved any characters from the
* various write() methods in a buffer, write them immediately to their
* intended destination. Then, if that destination is another character or
* byte stream, flush it. Thus one flush() invocation will flush all the
* buffers in a chain of Writers and OutputStreams.
*
* @exception IOException If an I/O error occurs
*/
public void flush() throws IOException { pw.flush(); };
/**
* Close the stream, flushing it first. Once a stream has been closed,
* further write() or flush() invocations will cause an IOException to be
* thrown. Closing a previously-closed stream, however, has no effect.
*
* @exception IOException If an I/O error occurs
*/
public void close() throws IOException { pw.flush(); pw.close(); }
/**
* @return the number of bytes unused in the buffer
*/
public int getRemaining() {
return (os != null) ? os.getBufferSize() - os.getCount() : 0;
}
/*
* fields
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -