Class ServletOutputStream

java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public abstract class ServletOutputStream extends OutputStream
Used to write output from a Servlet to the client. Servlet engines should provide a subclass of ServletOutputStream that implements OutputStream.write(int).

Note that I (MJW) do not understand how the print methods work when the stream uses something else then a simple ASCII character encoding. It seems saver to use ServletResponse.getWriter() for all output that is not binary.

Since:
Servlet API 1.0
Version:
Servlet API 2.2
  • Constructor Details

    • ServletOutputStream

      protected ServletOutputStream()
  • Method Details

    • print

      public void print(String value) throws IOException
      Writes a String.
      Parameters:
      value - the String to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(boolean value) throws IOException
      Writes a boolean.
      Parameters:
      value - the boolean to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(char value) throws IOException
      Writes a single char.
      Parameters:
      value - the char to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(int value) throws IOException
      Writes an int.
      Parameters:
      value - the int to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(long value) throws IOException
      Writes a long.
      Parameters:
      value - the long to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(float value) throws IOException
      Writes a float.
      Parameters:
      value - the float to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • print

      public void print(double value) throws IOException
      Writes a double.
      Parameters:
      value - the double to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println() throws IOException
      Writes a CRLF.
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(String value) throws IOException
      Writes a String followed by a CRLF.
      Parameters:
      value - the String to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(boolean value) throws IOException
      Writes a boolean followed by a CRLF.
      Parameters:
      value - the boolean to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(char value) throws IOException
      Writes a single char followed by a CRLF.
      Parameters:
      value - the char to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(int value) throws IOException
      Writes an int followed by a CRLF.
      Parameters:
      value - the int to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(long value) throws IOException
      Writes a long followed by a CRLF.
      Parameters:
      value - the long to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(float value) throws IOException
      Writes a float followed by a CRLF.
      Parameters:
      value - the float to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0
    • println

      public void println(double value) throws IOException
      Writes a double followed by a CRLF.
      Parameters:
      value - the double to be printed
      Throws:
      IOException - if an I/O exception occurs
      Since:
      Servlet API 1.0