易截截图软件、单文件、免安装、纯绿色、仅160KB

Java 实现文件分割合并的代码

import java.io.*;
class Fen{
String fileName;
int size;
Fen(String fileName,String size){
this.fileName = fileName;
this.size = Integer.parseInt(size)*1024;
}
public void cut()throws Exception{
int maxx = 0;
File inFile = new File(fileName);
int fileLength = (int)inFile.length(); //取得文件的大小
int value; //取得要分割的个数
RandomAccessFile inn = new RandomAccessFile(inFile,"r");//打开要分割的文件
value = fileLength/size;
int i=0;
int j=0;
//根据要分割的数目输出文件
for (;j File outFile = new File(inFile.getName()+j+"zzii");
RandomAccessFile outt= new RandomAccessFile(outFile,"rw");
maxx+=size;
for (;i outt.write(inn.read());
}
outt.close();
}
File outFile = new File(inFile.getName()+j+"zzii");
RandomAccessFile outt= new RandomAccessFile(outFile,"rw");
for(;i
outt.write(inn.read());
}
outt.close();
inn.close();
}
}
class He{
String fileName;
String filterName;
He(String fileName,String filterName){
this.fileName = fileName;
this.filterName = filterName;
}
public void unite()throws Exception{
String [] tt;
File inFile = new File("."); //在当前目录下的文件
File outFile = new File(fileName); //取得输出名
RandomAccessFile outt= new RandomAccessFile(outFile,"rw");
//取得符合条件的文件名
tt = inFile.list(new FilenameFilter(){
public boolean accept(File dir,String name){
String rr = new File(name).toString();
return rr.endsWith(filterName);
}
});
//打印出取得的文件名
for (int i = 0;i System.out.println(tt[i]);
}
//打开所有的文件再写入到一个文件里
for(int i=0;i inFile = new File(tt[i]);
RandomAccessFile inn= new RandomAccessFile(inFile,"r");
int c;
while((c=inn.read())!=-1)
outt.write(c);
}
outt.close();
}
}
public class test{
public static void main(final String [] args)throws Exception{
if(args.length==0){
print();
return;
}
if(args[0].equals("-c")){
Fen cutt = new Fen(args[1],args[2]);
cutt.cut();
}
else if (args[0].equals("-r")){
He hee = new He(args[1],args[2]);
hee.unite();
}
else


相关文档:

java中构造函数的调用顺序

当一个复杂的对象被构造时,它的构造函数按下面的顺序被调用(that the order of constructor calls for a complex object is as follows)
    1.其基类(base-class)的构造函数被调用,这个步骤以递归的方式重复,所以最底层(the root of hierarchy)的构造函数首先被执行,然后是它上一层派生类(the next-deriv ......

Map、Set、Iterator迭代详解与Java平台的集合框架


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......

java面试


一、Java部分(共40分)
1、 说说Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?(5分)
Overload是覆盖,子类的方法跟父类方法名字一样,子类的方法把父类的覆盖了。 
Override是重载,不同的方法参数、返回值不一样,紧紧返回值不一样的两个函数不叫重载,编译不会通过的。
Over ......

java获取当前日期的前一天日期与字符串日期之间的转换

         这几天一直在处理Java的日期问题,通常需要按要求生成日期的话,通常会用到util包中的Calendar类,再用Calendar的getTime()方法生成对应的Date,最后用SimpleDateFormat输出。
 
1. 获取当期日期、年份、月份
import java.util.Calendar;
public clas ......

2009年的Java技术发展趋势展望


已经有14岁的Java在日新月异的IT技术领域内不算年轻,但它一直没有停下变革,创新的脚步。Java已经不单单是一种计算机语言,很多情况下,我们称它是一个平台,一个社区,以及一个生态系统。下面从Java SE, Java EE, Java ME, JavaFX几个方面,简要介绍一下Java技术在2009年的变化和趋势。
JavaSE
目前JDK的正式版本是JD ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号