Package com.pff
Class PSTFile
- java.lang.Object
-
- com.pff.PSTFile
-
public class PSTFile extends java.lang.Object
PSTFile 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 boolean
bCPFirstTime
private static boolean
bFirstTime
private java.util.LinkedHashMap<java.lang.Integer,java.util.LinkedList<DescriptorIndexNode>>
childrenDescriptorTree
static int
ENCRYPTION_TYPE_COMPRESSIBLE
static int
ENCRYPTION_TYPE_NONE
private int
encryptionType
private java.util.HashMap<java.util.UUID,java.lang.Integer>
guidMap
private byte[]
guids
private static java.lang.String[]
guidStrings
private static java.util.HashMap<java.lang.Integer,java.lang.Long>
idToName
private java.util.HashMap<java.lang.Integer,java.lang.String>
idToString
private java.io.RandomAccessFile
in
private int
itemCount
private static int
MESSAGE_STORE_DESCRIPTOR_IDENTIFIER
private java.util.HashMap<java.lang.Long,java.lang.Integer>
nameToId
private static java.util.Properties
propertyInternetCodePages
private static java.util.Properties
propertyNames
static int
PS_INTERNET_HEADERS
static int
PS_MAPI
static int
PS_PUBLIC_STRINGS
static int
PSETID_Address
static int
PSETID_AirSync
static int
PSETID_Appointment
static int
PSETID_Common
static int
PSETID_Log
static int
PSETID_Meeting
static int
PSETID_Messaging
static int
PSETID_Note
static int
PSETID_PostRss
static int
PSETID_Sharing
static int
PSETID_Task
static int
PSETID_UnifiedMessaging
static int
PST_TYPE_ANSI
protected static int
PST_TYPE_ANSI_2
static int
PST_TYPE_UNICODE
private int
pstFileType
private static int
ROOT_FOLDER_DESCRIPTOR_IDENTIFIER
private 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 long
extractLEFileOffset(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 void
finalize()
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) DescriptorIndexNode
getDescriptorIndexNode(long identifier)
navigate the internal descriptor B-Tree and find a specific itemint
getEncryptionType()
get the type of encryption the file usesjava.io.RandomAccessFile
getFileHandle()
get the handle to the file we are currently accessing(package private) static java.lang.String
getInternetCodePageCharset(int propertyId)
int
getLeafSize(long bid)
PSTMessageStore
getMessageStore()
get the message store of the PST file.(package private) int
getNameToIdMapItem(int key, int propertySetIndex)
(package private) static long
getNameToIdMapKey(int id)
(package private) OffsetIndexItem
getOffsetIndexNode(long identifier)
navigate the internal index B-Tree and find a specific item(package private) static java.lang.String
getPropertyDescription(int entryType, int entryValueType)
(package private) static java.lang.String
getPropertyName(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)
int
getPSTFileType()
(package private) int
getPublicStringToIdMapItem(java.lang.String key)
PSTFolder
getRootFolder()
get the root folder for the PST file.private void
processDescriptorBTree(long btreeStartOffset)
Recursive function for building the descriptor tree, used by buildDescriptorTreeprivate void
processNameToIdMap(java.io.RandomAccessFile in)
read the name-to-id map from the file and load it in(package private) PSTNodeInputStream
readLeaf(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.IOException
constructor- Parameters:
fileName
-- Throws:
java.io.FileNotFoundException
PSTException
java.io.IOException
-
PSTFile
public PSTFile(java.io.File fileName) throws java.io.FileNotFoundException, PSTException, java.io.IOException
- Throws:
java.io.FileNotFoundException
PSTException
java.io.IOException
-
-
Method Detail
-
getPSTFileType
public int getPSTFileType()
-
processNameToIdMap
private void processNameToIdMap(java.io.RandomAccessFile in) throws java.io.IOException, PSTException
read the name-to-id map from the file and load it in- Parameters:
in
-- Throws:
java.io.IOException
PSTException
-
getData
private byte[] getData(PSTTableItem item, java.util.HashMap<java.lang.Integer,PSTDescriptorItem> localDescriptorItems) throws java.io.IOException, PSTException
- Throws:
java.io.IOException
PSTException
-
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.IOException
destructor just closes the file handle...- Overrides:
finalize
in 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:
PSTException
java.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:
PSTException
java.io.IOException
-
readLeaf
PSTNodeInputStream readLeaf(long bid) throws java.io.IOException, PSTException
- Throws:
java.io.IOException
PSTException
-
getLeafSize
public int getLeafSize(long bid) throws java.io.IOException, PSTException
- Throws:
java.io.IOException
PSTException
-
extractLEFileOffset
protected long extractLEFileOffset(long startOffset) throws java.io.IOException
Read 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, PSTException
Generic function used by getOffsetIndexNode and getDescriptorIndexNode for navigating the PST B-Trees- Parameters:
in
-index
-descTree
-- Returns:
- Throws:
java.io.IOException
PSTException
-
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.IOException
PSTException
-
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.IOException
PSTException
-
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:
PSTException
java.io.IOException
-
getPSTDescriptorItems
java.util.HashMap<java.lang.Integer,PSTDescriptorItem> getPSTDescriptorItems(PSTNodeInputStream in) throws PSTException, java.io.IOException
- Throws:
PSTException
java.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.IOException
PSTException
-
processDescriptorBTree
private void processDescriptorBTree(long btreeStartOffset) throws java.io.IOException, PSTException
Recursive function for building the descriptor tree, used by buildDescriptorTree- Parameters:
in
-btreeStartOffset
-- Throws:
java.io.IOException
PSTException
-
-