资源简介
外排序--基于败者树的多路归并排序算法的java实现
代码片段和文件信息
package ls;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class FileUtils {
public static InputStreamHolder getInputStreamHolder(String fileName int bufferSize) throws FileNotFoundException{
InputStreamHolder holder = new InputStreamHolder();
FileInputStream fileInputStream = new FileInputStream(fileName);
BufferedInputStream bufferedInputStream = new BufferedInputStream(
fileInputStream bufferSize);
DataInputStream dataInputStream = new DataInputStream(
bufferedInputStream);
holder.setFileInputStream(fileInputStream);
holder.setBufferedInputStream(bufferedInputStream);
holder.setDataInputStream(dataInputStream);
return holder;
}
public static InputStreamHolder getInputStreamHolder(File file int bufferSize) throws FileNotFoundException{
InputStreamHolder holder = new InputStreamHolder();
FileInputStream fileInputStream = new FileInputStream(file);
BufferedInputStream bufferedInputStream = new BufferedInputStream(
fileInputStream bufferSize);
DataInputStream dataInputStream = new DataInputStream(
bufferedInputStream);
holder.setFileInputStream(fileInputStream);
holder.setBufferedInputStream(bufferedInputStream);
holder.setDataInputStream(dataInputStream);
return holder;
}
public static OutputStreamHolder getOutputStreamHolder(File file) throws FileNotFoundException{
OutputStreamHolder holder = new OutputStreamHolder();
FileOutputStream fileOutputStream = new FileOutputStream(file);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);
holder.setFileOutputStream(fileOutputStream);
holder.setBufferedOutputStream(bufferedOutputStream);
holder.setDataOutputStream(dataOutputStream);
return holder;
}
public static OutputStreamHolder getOutputStreamHolder(String fileName) throws FileNotFoundException{
OutputStreamHolder holder = new OutputStreamHolder();
FileOutputStream fileOutputStream = new FileOutputStream(fileName);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);
holder.setFileOutputStream(fileOutputStream);
holder.setBufferedOutputStream(bufferedOutputStream);
holder.setDataOutputStream(dataOutputStream);
return holder;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2686 2015-04-21 16:57 外排序之多路归并\FileUtils.java
文件 913 2015-04-21 16:42 外排序之多路归并\InputStreamHolder.java
文件 7571 2015-04-21 17:13 外排序之多路归并\MultipleMerge.java
文件 948 2015-04-21 16:53 外排序之多路归并\OutputStreamHolder.java
文件 388 2015-04-21 14:08 外排序之多路归并\Result.java
目录 0 2015-04-21 17:47 外排序之多路归并
----------- --------- ---------- ----- ----
12506 6
- 上一篇:带有动画的java龟兔赛跑源代码 绝多好的
- 下一篇:Java版超级玛丽
评论
共有 条评论