计算机二级辅导:Java文件拆分器Java认证考试
文章作者 100test 发表时间 2010:02:11 02:23:14
来源 100Test.Com百考试题网
工具类:
import java.awt.FlowLayout.
import java.awt.Toolkit.
import java.awt.event.ActionListener.
import java.io.File.
import java.io.FileInputStream.
import java.io.FileNotFoundException.
import java.io.FileOutputStream.
import java.io.IOException.
import java.io.InputStream.
import java.io.InputStreamReader.
import javax.swing.JButton.
import javax.swing.JFrame.
import javax.swing.JPanel.
public class FileSplitUtilClass {
public static int data.//拆分的个数;
public static String str.
public static boolean split(File filePath,int number) {
byte[] b=new byte[number].
str=filePath.getAbsolutePath().
int i=0.//创建文件
try {
FileInputStream file=new FileInputStream(filePath).
try {
while(file.read(b)!=-1){
i .
FileOutputStream fileout=new FileOutputStream(str i).
fileout.write(b).
}
file.close().
FileSplitUtilClass.data=i.
filePath.0delete().
return true.