Class PstFile

java.lang.Object
com.independentsoft.pst.PstFile

public class PstFile extends Object
The Class PstFile.
  • Constructor Details

    • PstFile

      public PstFile()
      Instantiates a new pst file.
    • PstFile

      public PstFile(String filePath, PstAccess access) throws IOException
      Initializes a new instance of the PstFile class with the given access mode. READ_WRITE opens the file for in-place editing (changes persisted by save()); READ opens it read-only.
      Parameters:
      filePath - the file path.
      access - the access mode.
      Throws:
      IOException - if an I/O error occurs.
    • PstFile

      public PstFile(String filePath) throws IOException
      Instantiates a new pst file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • PstFile

      public PstFile(String filePath, String charset) throws IOException
      Instantiates a new pst file.
      Parameters:
      filePath - the file path
      charset - the charset
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • PstFile

      public PstFile(File file) throws IOException
      Instantiates a new pst file.
      Parameters:
      file - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • PstFile

      public PstFile(File file, String charset) throws IOException
      Instantiates a new pst file.
      Parameters:
      file - the file
      charset - the charset
      Throws:
      IOException - Signals that an I/O exception has occurred.
  • Method Details

    • create

      public static PstFile create(String filePath) throws IOException
      Creates a new Unicode PST file with the message store and the default (Outlook) folder structure, opened for editing. Add user folders and items via getRoot(), then call save() to persist the changes.
      Parameters:
      filePath - the destination file path.
      Returns:
      an editable PstFile.
      Throws:
      IOException - if an I/O error occurs.
    • save

      public void save() throws IOException
      Persists the edits of a store opened for editing (via create(String) or READ_WRITE) back to its source.
      Throws:
      IOException - if an I/O error occurs.
    • save

      public void save(String filePath) throws IOException
      Persists the edits of a store opened for editing to the given path.
      Parameters:
      filePath - the destination file path.
      Throws:
      IOException - if an I/O error occurs.
    • open

      public void open(String filePath) throws IOException
      Open.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • open

      public void open(String filePath, String charset) throws IOException
      Open.
      Parameters:
      filePath - the file path
      charset - the charset
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • open

      public void open(File file) throws IOException
      Open.
      Parameters:
      file - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • open

      public void open(File file, String charset) throws IOException
      Open.
      Parameters:
      file - the file
      charset - the charset
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • close

      public void close() throws IOException
      Close.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getFolder

      public Folder getFolder(byte[] entryId) throws IOException
      Gets the folder.
      Parameters:
      entryId - the entry id
      Returns:
      the folder
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getFolder

      public Folder getFolder(long id) throws IOException
      Gets the folder.
      Parameters:
      id - the id
      Returns:
      the folder
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getItem

      public Item getItem(byte[] entryId) throws IOException
      Gets the item.
      Parameters:
      entryId - the entry id
      Returns:
      the item
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getItem

      public Item getItem(long id) throws IOException
      Gets the item.
      Parameters:
      id - the id
      Returns:
      the item
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • is64Bit

      public boolean is64Bit()
      Checks if is 64 bit.
      Returns:
      true, if is 64 bit
    • getSize

      public long getSize()
      Gets the size.
      Returns:
      the size
    • getEncryptionType

      public EncryptionType getEncryptionType()
      Gets the encryption type.
      Returns:
      the encryption type
    • getMessageStore

      public MessageStore getMessageStore()
      Gets the message store.
      Returns:
      the message store
    • getRoot

      public Folder getRoot()
      Gets the root.
      Returns:
      the root
    • getMailboxRoot

      public Folder getMailboxRoot()
      Gets the mailbox root.
      Returns:
      the mailbox root
    • getCharset

      public String getCharset()
      Gets the charset.
      Returns:
      the charset
    • setCharset

      public void setCharset(String charset)
      Sets the charset.
      Parameters:
      charset - the new charset