Package com.pff

Class 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 Detail

      • 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
      • PSETID_UnifiedMessaging

        public static final int PSETID_UnifiedMessaging
        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
      • 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 class java.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
      • 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 file
        startOffset - 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
      • 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