写入文件

    try{
    FileWriter fw=new FileWriter(SystemConfig.getRealPath()+"WEB-INF/url.txt");
    fw.write("movie"+name);
    fw.close();
   }catch(IOException e){
   e.printStackTrace();
   }

读文件中内容

   try{
       FileReader fr = null;
           fr = new FileReader(SystemConfig.getRealPath()+"WEB-INF/url.txt");
       BufferedReader br=new BufferedReader(fr);
       String Line = null;
           Line = br.readLine();
       while(Line!=null){
           s=Line;
           Line=null;
           br.close();
           fr.close();
       }
       }catch(IOException e1){
           e1.printStackTrace();
       }

上传文件

    try {
        InputStream stream = getUpFile().getInputStream();//把文件读入
        OutputStream bos = new FileOutputStream(filePath + "movie" +name);//建立一个上传文件的输出流
        int bytesRead = 0;
        byte[] buffer = new byte[1026];
        while ( (bytesRead = stream.read(buffer, 0, 1026)) != -1) {
          bos.write(buffer, 0, bytesRead);//将文件写入服务器
        }
        bos.close();
        stream.close();
      }catch(Exception e){
        System.err.print(e);
      }



柴油发电机
发电机
柴油机
柴油发电机
13636374743(上海)
13291526067(嘉兴)