java -file

package com.gyl.framework.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import com.sun.org.apache.bcel.internal.generic.NEW;

public class ScriptGen {
 
 public static void main(String[] args)throws Exception{
  gen("c:/temp");
 }
 
 public static void gen (String path) throws Exception {
  File f = new File(path);
  StringBuffer buffer = new StringBuffer();
  File[] files  = f.listFiles();
  for (int i = 0; i < files.length-1; i++) {
   File tempFile = files[i];
   if(tempFile.isFile()){
    FileInputStream reader = new FileInputStream(tempFile);
    String string = null;
    byte[] bytes = new byte[1024*1024];
    int len = -1;
    do{
     len = reader.read(bytes);
     if (len!=-1) {
      System.out.println(new String (bytes,0,len,"GBK"));
     }
    }while(len!=-1);
    System.out.println();
    System.out.println();
   }
  }
 }
}

你可能感兴趣的:(java)