您的位置:首页 > 编程语言 > Java开发

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) {
     }
 }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java file string byte c