Package com.pff
Class PSTFile
- java.lang.Object
-
- com.pff.PSTFile
-
public class PSTFile extends java.lang.ObjectPSTFile is the containing class that allows you to access items within a .pst file. Start here, get the root of the folders and work your way down through your items.
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanbCPFirstTimeprivate static booleanbFirstTimeprivate java.util.LinkedHashMap<java.lang.Integer,java.util.LinkedList<DescriptorIndexNode>>childrenDescriptorTreestatic intENCRYPTION_TYPE_COMPRESSIBLEstatic intENCRYPTION_TYPE_NONEprivate intencryptionTypeprivate java.util.HashMap<java.util.UUID,java.lang.Integer>guidMapprivate byte[]guidsprivate static java.lang.String[]guidStringsprivate static java.util.HashMap<java.lang.Integer,java.lang.Long>idToNameprivate java.util.HashMap<java.lang.Integer,java.lang.String>idToStringprivate java.io.RandomAccessFileinprivate intitemCountprivate static intMESSAGE_STORE_DESCRIPTOR_IDENTIFIERprivate java.util.HashMap<java.lang.Long,java.lang.Integer>nameToIdprivate static java.util.PropertiespropertyInternetCodePagesprivate static java.util.PropertiespropertyNamesstatic intPS_INTERNET_HEADERSstatic intPS_MAPIstatic intPS_PUBLIC_STRINGSstatic intPSETID_Addressstatic intPSETID_AirSyncstatic intPSETID_Appointmentstatic intPSETID_Commonstatic intPSETID_Logstatic intPSETID_Meetingstatic intPSETID_Messagingstatic intPSETID_Notestatic intPSETID_PostRssstatic intPSETID_Sharingstatic intPSETID_Taskstatic intPSETID_UnifiedMessagingstatic intPST_TYPE_ANSIprotected static intPST_TYPE_ANSI_2static intPST_TYPE_UNICODEprivate intpstFileTypeprivate static intROOT_FOLDER_DESCRIPTOR_IDENTIFIERprivate java.util.HashMap<java.lang.String,java.lang.Integer>stringToId
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longextractLEFileOffset(long startOffset)Read a file offset from the file PST Files have this tendency to store file offsets (pointers) in 8 little endian bytes.protected voidfinalize()destructor just closes the file handle...private byte[]findBtreeItem(java.io.RandomAccessFile in, long index, boolean descTree)Generic function used by getOffsetIndexNode and getDescriptorIndexNode for navigating the PST B-Trees(package private) java.util.LinkedHashMap<java.lang.Integer,java.util.LinkedList<DescriptorIndexNode>>getChildDescriptorTree()Build the children descriptor tree This goes through the entire descriptor B-Tree and adds every item to the childrenDescriptorTree.private byte[]getData(PSTTableItem item, java.util.HashMap<java.lang.Integer,PSTDescriptorItem> localDescriptorItems)(package private) DescriptorIndexNodegetDescriptorIndexNode(long identifier)navigate the internal descriptor B-Tree and find a specific itemintgetEncryptionType()get the type of encryption the file usesjava.io.RandomAccessFilegetFileHandle()get the handle to the file we are currently accessing(package private) static java.lang.StringgetInternetCodePageCharset(int propertyId)intgetLeafSize(long bid)PSTMessageStoregetMessageStore()get the message store of the PST file.(package private) intgetNameToIdMapItem(int key, int propertySetIndex)(package private) static longgetNameToIdMapKey(int id)(package private) OffsetIndexItemgetOffsetIndexNode(long identifier)navigate the internal index B-Tree and find a specific item(package private) static java.lang.StringgetPropertyDescription(int entryType, int entryValueType)(package private) static java.lang.StringgetPropertyName(int propertyId, boolean bNamed)(package private) java.util.HashMap<java.lang.Integer,PSTDescriptorItem>getPSTDescriptorItems(long localDescriptorsOffsetIndexIdentifier)parse a PSTDescriptor and get all of its items(package private) java.util.HashMap<java.lang.Integer,PSTDescriptorItem>getPSTDescriptorItems(PSTNodeInputStream in)intgetPSTFileType()(package private) intgetPublicStringToIdMapItem(java.lang.String key)PSTFoldergetRootFolder()get the root folder for the PST file.private voidprocessDescriptorBTree(long btreeStartOffset)Recursive function for building the descriptor tree, used by buildDescriptorTreeprivate voidprocessNameToIdMap(java.io.RandomAccessFile in)read the name-to-id map from the file and load it in(package private) PSTNodeInputStreamreadLeaf(long bid)
-
-
-
Field Detail
-
ENCRYPTION_TYPE_NONE
public static final int ENCRYPTION_TYPE_NONE
- See Also:
- Constant Field Values
-
ENCRYPTION_TYPE_COMPRESSIBLE
public static final int ENCRYPTION_TYPE_COMPRESSIBLE
- See Also:
- Constant Field Values
-
MESSAGE_STORE_DESCRIPTOR_IDENTIFIER
private static final int MESSAGE_STORE_DESCRIPTOR_IDENTIFIER
- See Also:
- Constant Field Values
-
ROOT_FOLDER_DESCRIPTOR_IDENTIFIER
private static final int ROOT_FOLDER_DESCRIPTOR_IDENTIFIER
- See Also:
- Constant Field Values
-
PST_TYPE_ANSI
public static final int PST_TYPE_ANSI
- See Also:
- Constant Field Values
-
PST_TYPE_ANSI_2
protected static final int PST_TYPE_ANSI_2
- See Also:
- Constant Field Values
-
PST_TYPE_UNICODE
public static final int PST_TYPE_UNICODE
- See Also:
- Constant Field Values
-
PS_PUBLIC_STRINGS
public static final int PS_PUBLIC_STRINGS
- See Also:
- Constant Field Values
-
PSETID_Common
public static final int PSETID_Common
- See Also:
- Constant Field Values
-
PSETID_Address
public static final int PSETID_Address
- See Also:
- Constant Field Values
-
PS_INTERNET_HEADERS
public static final int PS_INTERNET_HEADERS
- See Also:
- Constant Field Values
-
PSETID_Appointment
public static final int PSETID_Appointment
- See Also:
- Constant Field Values
-
PSETID_Meeting
public static final int PSETID_Meeting
- See Also:
- Constant Field Values
-
PSETID_Log
public static final int PSETID_Log
- See Also:
- Constant Field Values
-
PSETID_Messaging
public static final int PSETID_Messaging
- See Also:
- Constant Field Values
-
PSETID_Note
public static final int PSETID_Note
- See Also:
- Constant Field Values
-
PSETID_PostRss
public static final int PSETID_PostRss
- See Also:
- Constant Field Values
-
PSETID_Task
public static final int PSETID_Task
- See Also:
- Constant Field Values
-
PSETID_UnifiedMessaging
public static final int PSETID_UnifiedMessaging
- See Also:
- Constant Field Values
-
PS_MAPI
public static final int PS_MAPI
- See Also:
- Constant Field Values
-
PSETID_AirSync
public static final int PSETID_AirSync
- See Also:
- Constant Field Values
-
PSETID_Sharing
public static final int PSETID_Sharing
- See Also:
- Constant Field Values
-
guidStrings
private static final java.lang.String[] guidStrings
-
guidMap
private java.util.HashMap<java.util.UUID,java.lang.Integer> guidMap
-
encryptionType
private int encryptionType
-
childrenDescriptorTree
private java.util.LinkedHashMap<java.lang.Integer,java.util.LinkedList<DescriptorIndexNode>> childrenDescriptorTree
-
nameToId
private java.util.HashMap<java.lang.Long,java.lang.Integer> nameToId
-
stringToId
private java.util.HashMap<java.lang.String,java.lang.Integer> stringToId
-
idToName
private static java.util.HashMap<java.lang.Integer,java.lang.Long> idToName
-
idToString
private java.util.HashMap<java.lang.Integer,java.lang.String> idToString
-
guids
private byte[] guids
-
itemCount
private int itemCount
-
in
private java.io.RandomAccessFile in
-
pstFileType
private int pstFileType
-
propertyInternetCodePages
private static java.util.Properties propertyInternetCodePages
-
bCPFirstTime
private static boolean bCPFirstTime
-
propertyNames
private static java.util.Properties propertyNames
-
bFirstTime
private static boolean bFirstTime
-
-
Constructor Detail
-
PSTFile
public PSTFile(java.lang.String fileName) throws java.io.FileNotFoundException, PSTException, java.io.IOExceptionconstructor- Parameters:
fileName-- Throws:
java.io.FileNotFoundExceptionPSTExceptionjava.io.IOException
-
PSTFile
public PSTFile(java.io.File fileName) throws java.io.FileNotFoundException, PSTException, java.io.IOException- Throws:
java.io.FileNotFoundExceptionPSTExceptionjava.io.IOException
-
-
Method Detail
-
getPSTFileType
public int getPSTFileType()
-
processNameToIdMap
private void processNameToIdMap(java.io.RandomAccessFile in) throws java.io.IOException, PSTExceptionread the name-to-id map from the file and load it in- Parameters:
in-- Throws:
java.io.IOExceptionPSTException
-
getData
private byte[] getData(PSTTableItem item, java.util.HashMap<java.lang.Integer,PSTDescriptorItem> localDescriptorItems) throws java.io.IOException, PSTException
- Throws:
java.io.IOExceptionPSTException
-
getNameToIdMapItem
int getNameToIdMapItem(int key, int propertySetIndex)
-
getPublicStringToIdMapItem
int getPublicStringToIdMapItem(java.lang.String key)
-
getNameToIdMapKey
static long getNameToIdMapKey(int id)
-
getInternetCodePageCharset
static java.lang.String getInternetCodePageCharset(int propertyId)
-
getPropertyName
static java.lang.String getPropertyName(int propertyId, boolean bNamed)
-
getPropertyDescription
static java.lang.String getPropertyDescription(int entryType, int entryValueType)
-
finalize
protected void finalize() throws java.io.IOExceptiondestructor just closes the file handle...- Overrides:
finalizein classjava.lang.Object- Throws:
java.io.IOException
-
getEncryptionType
public int getEncryptionType()
get the type of encryption the file uses- Returns:
- encryption type used in the PST File
-
getFileHandle
public java.io.RandomAccessFile getFileHandle()
get the handle to the file we are currently accessing
-
getMessageStore
public PSTMessageStore getMessageStore() throws PSTException, java.io.IOException
get the message store of the PST file. Note that this doesn't really have much information, better to look under the root folder- Throws:
PSTExceptionjava.io.IOException
-
getRootFolder
public PSTFolder getRootFolder() throws PSTException, java.io.IOException
get the root folder for the PST file. You should find all of your data under here...- Throws:
PSTExceptionjava.io.IOException
-
readLeaf
PSTNodeInputStream readLeaf(long bid) throws java.io.IOException, PSTException
- Throws:
java.io.IOExceptionPSTException
-
getLeafSize
public int getLeafSize(long bid) throws java.io.IOException, PSTException- Throws:
java.io.IOExceptionPSTException
-
extractLEFileOffset
protected long extractLEFileOffset(long startOffset) throws java.io.IOExceptionRead a file offset from the file PST Files have this tendency to store file offsets (pointers) in 8 little endian bytes. Convert this to a long for seeking to.- Parameters:
in- handle for PST filestartOffset- where to read the 8 bytes from- Returns:
- long representing the read location
- Throws:
java.io.IOException
-
findBtreeItem
private byte[] findBtreeItem(java.io.RandomAccessFile in, long index, boolean descTree) throws java.io.IOException, PSTExceptionGeneric function used by getOffsetIndexNode and getDescriptorIndexNode for navigating the PST B-Trees- Parameters:
in-index-descTree-- Returns:
- Throws:
java.io.IOExceptionPSTException
-
getDescriptorIndexNode
DescriptorIndexNode getDescriptorIndexNode(long identifier) throws java.io.IOException, PSTException
navigate the internal descriptor B-Tree and find a specific item- Parameters:
in-identifier-- Returns:
- the descriptor node for the item
- Throws:
java.io.IOExceptionPSTException
-
getOffsetIndexNode
OffsetIndexItem getOffsetIndexNode(long identifier) throws java.io.IOException, PSTException
navigate the internal index B-Tree and find a specific item- Parameters:
in-identifier-- Returns:
- the offset index item
- Throws:
java.io.IOExceptionPSTException
-
getPSTDescriptorItems
java.util.HashMap<java.lang.Integer,PSTDescriptorItem> getPSTDescriptorItems(long localDescriptorsOffsetIndexIdentifier) throws PSTException, java.io.IOException
parse a PSTDescriptor and get all of its items- Throws:
PSTExceptionjava.io.IOException
-
getPSTDescriptorItems
java.util.HashMap<java.lang.Integer,PSTDescriptorItem> getPSTDescriptorItems(PSTNodeInputStream in) throws PSTException, java.io.IOException
- Throws:
PSTExceptionjava.io.IOException
-
getChildDescriptorTree
java.util.LinkedHashMap<java.lang.Integer,java.util.LinkedList<DescriptorIndexNode>> getChildDescriptorTree() throws java.io.IOException, PSTException
Build the children descriptor tree This goes through the entire descriptor B-Tree and adds every item to the childrenDescriptorTree. This is used as fallback when the nodes that list file contents are broken.- Parameters:
in-- Throws:
java.io.IOExceptionPSTException
-
processDescriptorBTree
private void processDescriptorBTree(long btreeStartOffset) throws java.io.IOException, PSTExceptionRecursive function for building the descriptor tree, used by buildDescriptorTree- Parameters:
in-btreeStartOffset-- Throws:
java.io.IOExceptionPSTException
-
-