java常用方法
2005-01-31 15:20
363 查看
是不是半角片假名
public static boolean isKatakana(byte c) {
int i = 0xff & c;
return (i > 0xa0 && i < 0xe0);
}
/**
* 移动文件夹内的全部文件到另一文件夹下
* @param fromFile 源文件夹
* @param toFile 目的文件夹
*/
public static void copyOneToAnother(File fromFile, File toFile){
if(fromFile.isDirectory()){
if (!toFile.exists()) {
toFile.mkdir();
}
String[] children = fromFile.list();
for (int i=0; i<children.length; i++) {
copyOneToAnother(new File(fromFile, children[i]),
new File(toFile, children[i]));
}
}else{
try {
FileChannel fromChannel = new FileInputStream(fromFile).getChannel();
FileChannel toChannel = new FileOutputStream(toFile).getChannel();
//移动文件
toChannel.transferFrom(fromChannel, 0, fromChannel.size());
//关闭通道
fromChannel.close();
toChannel.close();
} catch (IOException e) {
}
}
}
public static boolean isKatakana(byte c) {
int i = 0xff & c;
return (i > 0xa0 && i < 0xe0);
}
/**
* 移动文件夹内的全部文件到另一文件夹下
* @param fromFile 源文件夹
* @param toFile 目的文件夹
*/
public static void copyOneToAnother(File fromFile, File toFile){
if(fromFile.isDirectory()){
if (!toFile.exists()) {
toFile.mkdir();
}
String[] children = fromFile.list();
for (int i=0; i<children.length; i++) {
copyOneToAnother(new File(fromFile, children[i]),
new File(toFile, children[i]));
}
}else{
try {
FileChannel fromChannel = new FileInputStream(fromFile).getChannel();
FileChannel toChannel = new FileOutputStream(toFile).getChannel();
//移动文件
toChannel.transferFrom(fromChannel, 0, fromChannel.size());
//关闭通道
fromChannel.close();
toChannel.close();
} catch (IOException e) {
}
}
}
相关文章推荐
- java常用类——java web接受文件表单时常用文件解析方法
- Java中常用的类与基本方法
- java并发库之Executors常用的创建ExecutorService的几个方法说明
- java 常用的反射方法
- Java常用类及其方法(一)Object
- java常用类的方法
- Java date常用方法总结
- java中常用字符串截取方法
- java.io.File操作文件的一些常用方法
- Java中常用的内存区域 及其 static 方法的调用
- Java常用方法
- java之集合框架使用细节及常用方法
- Java_Integer 类常用方法总结
- 【转】JPDA:Java平台调试架构(常用的远程调试方法)
- Java的日期格式化常用方法
- Java的SimpleDateFormat常用方法说明整理
- java -Math常用方法
- java中常用的字符串的截取方法 (2011-03-17 00:41:31)
- JAVA String类的常用方法总结
- java 防止 XSS 攻击的常用方法总结.