Class FileOpenSaveDialog

java.lang.Object
org.apache.pdfbox.debugger.ui.FileOpenSaveDialog

public class FileOpenSaveDialog extends Object
  • Field Details

  • Constructor Details

    • FileOpenSaveDialog

      public FileOpenSaveDialog(Component parentUI, FileFilter fileFilter)
      Constructor.
      Parameters:
      parentUI - the main UI (JFrame) on top of which File open/save dialog should open.
      fileFilter - file Filter, null is allowed when no filter is applicable.
  • Method Details

    • saveFile

      public boolean saveFile(byte[] bytes, String extension) throws IOException
      Saves data into a file after the user is prompted to choose the destination.
      Parameters:
      bytes - byte array to be saved in a file.
      Returns:
      true if the file is saved successfully or false if failed.
      Throws:
      IOException - if there is an error in creation of the file.
    • saveDocument

      public boolean saveDocument(PDDocument document, String extension) throws IOException
      Saves document into a .pdf file after the user is prompted to choose the destination.
      Parameters:
      document - document to be saved in a .pdf file.
      extension - file extension.
      Returns:
      true if the file is saved successfully or false if failed.
      Throws:
      IOException - if there is an error in creation of the file.
    • openFile

      public File openFile() throws IOException
      open a file prompting user to select the file.
      Returns:
      the file opened.
      Throws:
      IOException - if there is error in opening the file.