您的位置:首页 > 其它

文件流复用方法

2015-07-01 20:08 441 查看
package jdk7;

import java.io.BufferedInputStream;

import java.io.IOException;

import java.io.InputStream;

public class fileTool {

public InputStream in=null;

//设置支持流复用

public void markSupported(InputStream input){

//不支持

if (!input.markSupported()){

in=new BufferedInputStream(input);

}else{

in=input;

}

}

public InputStream getInputStream(){

in.mark(Integer.MAX_VALUE);

return in;

}

public void marked() throws IOException{

in.reset();

}

public static void main(String[] args) {

// TODO Auto-generated method stub

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: