示例#1
0
  private static void moveVoicemail(String strContact, String strID, String strTempVMTS) {
    System.out.println(strContact + " " + strID + " " + strTempVMTS);

    try {
      File fSrc = new File(strSrcVMDir + "/" + strID + ".amr");
      File fDest = new File(strDestVMDir + strContact + "/" + strTempVMTS + ".amr");
      InputStream isSrc = new FileInputStream(fSrc);

      OutputStream osDest = new FileOutputStream(fDest);

      byte[] buf = new byte[1024];
      int len;
      while ((len = isSrc.read(buf)) > 0) {
        osDest.write(buf, 0, len);
      }
      isSrc.close();
      osDest.close();
      System.out.println("File copied.");
    } catch (Exception e) {
      System.err.println(e.getLocalizedMessage());
      System.err.println();
      System.err.println(e.getStackTrace());
      System.exit(0);
    }
  }
示例#2
0
 private static void createContactDir(String strContact) {
   File dirCurrent = new File(strDestVMDir + strContact);
   if (!dirCurrent.exists()) {
     try {
       boolean success = (dirCurrent).mkdir();
       if (!success) {
         throw new Exception("Well that wasn't planned for...");
       }
     } catch (Exception e) {
       System.err.println(e.getLocalizedMessage());
       System.err.println();
       System.err.println(e.getStackTrace());
       System.exit(0);
     }
   }
 }