示例#1
0
  public static void upload(List<ArgumentWrapper> argsArray, Session currentSession) {
    // Get path from arguments
    String path = Common.getParamString(argsArray, "path");
    byte[] data = Common.getParam(argsArray, "data");

    File file = new File(path);
    BufferedOutputStream out = null;

    try {
      out = new BufferedOutputStream(new FileOutputStream(file, true));
      out.write(data);

      currentSession.sendFullTransmission("", "");

    } catch (Exception e) {
      currentSession.sendFullTransmission("", e.getMessage());
    } finally {
      // Close file
      if (out != null) {
        try {
          out.close();
        } catch (Exception e) {
        }
      }
    }
  }