Javatpoint Logo

91-9990449935

 0120-4256464

ServletOutputStream class

ServletOutputStream class provides a stream to write binary data into the response. It is an abstract class.

The getOutputStream() method of ServletResponse interface returns the instance of ServletOutputStream class. It may be get as:

Methods of ServletOutputStream class

The ServletOutputStream class provides print() and println() methods that are overloaded.

  1. void print(boolean b){}
  2. void print(char c){}
  3. void print(int i){}
  4. void print(long l){}
  5. void print(float f){}
  6. void print(double d){}
  7. void print(String s){}
  8. void println{}
  9. void println(boolean b){}
  10. void println(char c){}
  11. void println(int i){}
  12. void println(long l){}
  13. void println(float f){}
  14. void println(double d){}
  15. void println(String s){}

Example of ServletOutputStream class

Example of ServletOutputStream class to write image