文件流复用方法
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
}
}
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
}
}
相关文章推荐
- C++11 实现 argsort
- 内存相关命令
- Android中控件spinner的使用
- Pascal's Triangle II
- 统计图形-点图
- 安卓杀死进程关闭程序
- androidstudio导入eclipse源码和乱码问题
- LeetCode || 未完成的题目
- mac root permission
- awk向脚本传递参数(二)
- objc一个NetConnector类示例
- objc一个NetConnector类示例
- javaSE学习笔记之数据类型
- Android关于gridview平滑滚动定位smoothScrollToPositionFromTop方法测试
- leetcode-10 Regular Expression Matching
- objc一个NetConnector类示例
- 世界、明天、生活和我
- new与delete
- ExtJs中分页时带查询条件
- 如何手工释放linux内存