@Override
  public void execute() throws Exception {
    ConsoleHelper.writeMessage("Archive content view.");

    ZipFileManager zipFileManager = getZipFileManager();

    ConsoleHelper.writeMessage("Archive content:");

    List<FileProperties> files = zipFileManager.getFilesList();
    for (FileProperties file : files) {
      ConsoleHelper.writeMessage(file.toString());
    }

    ConsoleHelper.writeMessage("Archive content have been read.");
  }
Exemplo n.º 2
0
  @Override
  public void execute() throws Exception {
    try {
      ConsoleHelper.writeMessage("Adding new file to archive...");

      ZipFileManager zipFileManager = getZipFileManager();

      ConsoleHelper.writeMessage("Enter absolute path to file for adding:");
      Path sourcePath = Paths.get(ConsoleHelper.readString());

      zipFileManager.addFile(sourcePath);

      ConsoleHelper.writeMessage("Adding new file completed.");

    } catch (PathIsNotFoundException e) {
      ConsoleHelper.writeMessage("File not found.");
    }
  }