Class PstStoreWriter
java.lang.Object
com.independentsoft.pst.PstStoreWriter
Writes a new Unicode PST file from a tree of
PstFolderWriter/PstMessageWriter objects, or edits an
existing PST in place (open it, add folders/items via getRoot(), then save(String)).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongAdds a folder under the folder with the given node id, returning its node id.longAdds a folder under the top of the personal-folders subtree, returning its node id.longAdds a folder under the top of the personal-folders subtree, returning its node id.longAdds an item to the folder with the given node id, returning the new item's node id.Adds many items to a folder in a single pass (one contents-table rebuild and one count update for all).voidclose()Releases the working file used while editing.getFolder(long nid) Gets a writer-attached navigableFolderfor the given nid in the edited store (null if not found).getRoot()Gets the editable root folder ("Top of Personal Folders") of a store opened withopen(String).Gets the root user folder ("Top of Personal Folders").booleanGets whether to include the default search-folder infrastructure.voidopen(InputStream stream) Opens an existing PST from a stream for editing.voidOpens an existing PST file for editing.voidsave(OutputStream stream) Writes the PST file to the specified stream.voidWrites the PST file to the specified path.voidsetIncludeSearchFolder(boolean includeSearchFolder) Sets whether to include the default search-folder infrastructure.
-
Constructor Details
-
PstStoreWriter
public PstStoreWriter()Initializes a new instance of thePstStoreWriterclass.
-
-
Method Details
-
isIncludeSearchFolder
public boolean isIncludeSearchFolder()Gets whether to include the default search-folder infrastructure.- Returns:
- whether the search-folder infrastructure is included.
-
setIncludeSearchFolder
public void setIncludeSearchFolder(boolean includeSearchFolder) Sets whether to include the default search-folder infrastructure.- Parameters:
includeSearchFolder- whether the search-folder infrastructure is included.
-
getTopOfPersonalFolders
Gets the root user folder ("Top of Personal Folders"). Folders added here appear under the store in Outlook.- Returns:
- the top-of-personal-folders writer.
-
open
Opens an existing PST file for editing. Subsequent changes are written bysave(String).- Parameters:
filePath- the PST file to open.- Throws:
IOException- if an I/O error occurs.
-
open
Opens an existing PST from a stream for editing.- Parameters:
stream- the source stream.- Throws:
IOException- if an I/O error occurs.
-
addFolder
Adds a folder under the top of the personal-folders subtree, returning its node id.- Parameters:
name- the display name of the new folder.- Returns:
- the new folder's NID.
- Throws:
IOException- if an I/O error occurs.
-
addFolder
Adds a folder under the top of the personal-folders subtree, returning its node id.- Parameters:
folder- the folder to add.- Returns:
- the new folder's NID.
- Throws:
IOException- if an I/O error occurs.
-
addFolder
Adds a folder under the folder with the given node id, returning its node id.- Parameters:
parentNid- the parent folder's node id.folder- the folder to add.- Returns:
- the new folder's NID.
- Throws:
IOException- if an I/O error occurs.
-
getRoot
Gets the editable root folder ("Top of Personal Folders") of a store opened withopen(String).- Returns:
- the editable root folder.
- Throws:
IOException- if an I/O error occurs.
-
getFolder
Gets a writer-attached navigableFolderfor the given nid in the edited store (null if not found).- Parameters:
nid- the folder node id.- Returns:
- the folder, or
null. - Throws:
IOException- if an I/O error occurs.
-
addItem
Adds an item to the folder with the given node id, returning the new item's node id.- Parameters:
folderNid- the target folder's node id.item- the item to add.- Returns:
- the new item's NID.
- Throws:
IOException- if an I/O error occurs.
-
addItems
Adds many items to a folder in a single pass (one contents-table rebuild and one count update for all).- Parameters:
folderNid- the target folder's node id.items- the items to add.- Returns:
- the new item NIDs.
- Throws:
IOException- if an I/O error occurs.
-
save
Writes the PST file to the specified path.- Parameters:
filePath- the destination file path.- Throws:
IOException- if an I/O error occurs.
-
save
Writes the PST file to the specified stream.- Parameters:
stream- the destination stream.- Throws:
IOException- if an I/O error occurs.
-
close
Releases the working file used while editing. Call aftersave(String)when done editing.- Throws:
IOException- if an I/O error occurs.
-