当前位置: 代码迷 >> Web前端 >> ServletOutputStream种 简要说明
  详细解决方案

ServletOutputStream种 简要说明

热度:393   发布时间:2013-09-26 10:32:35.0
ServletOutputStream类 简要说明

定义

??????

public abstract class ServletOutputStream extends OutputStream

??

?????? 这是一个由Servlet引擎使用的抽象类。Servlet通过使用ServletResponse接口的使用获得了对一个这种类型的对象的说明。利用这个输出流可以将数据返回到客户端。

?????? 这个类的子类必须提供一个向OutputStream接口写入有关信息的方法。

?????? 在这个接口中,当一个刷新或关闭的方法被调用时。所有数据缓冲区的信息将会被发送到客户端,也就是说响应被提交了。请注意,关闭这种类型的对象时不一定要关闭隐含的socket流。

方法

?????? 1、print

       public void print(String s) throws IOException;
       public void print(boolean b) throws IOException;
       public void print(char c) throws IOException;
       public void print(int i) throws IOException;
       public void print(long l) throws IOException;
       public void print(float f) throws IOException;
       public void print(double d) throws IOException;

??????? 输出变量到输出流中

? 2、println

?

?

?

?

       public void println() throws IOException;
       public void println(String s) throws IOException;
       public void println(boolean b) throws IOException;
       public void println(char c) throws IOException;
       public void println(int i) throws IOException;
       public void println(long l) throws IOException;
       public void println(float f) throws IOException;
       public void println(double d) throws IOException;

?

输出变量到输出流中,并增加一个回车换行符

  相关解决方案