Package io.github.jmcleodfoss.pst
Class PSTFile
java.lang.Object
io.github.jmcleodfoss.pst.PSTFile
- Direct Known Subclasses:
PST
public class PSTFile extends Object
The PSTFile class is a convenience container class used to read later data from the file.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PSTFile(FileInputStream stream)
Create a FileChannel for the given filename and read in the PST header. -
Method Summary
Modifier and Type Method Description void
close()
Close the PSTFile file.static ByteBuffer
makeByteBuffer(byte[] bytes)
Create a ByteBuffer with the right byte ordering from the given array.ByteBuffer
read(int position, int length)
Read data from the given position as a ByteBufferboolean
unicode()
A convenience method to indicate whether the PST file uses Unicode or ANSI encoding.
-
Field Details
-
header
The PST header, which contains encryption and file format information as well as other useful data.
-
-
Constructor Details
-
PSTFile
Create a FileChannel for the given filename and read in the PST header.- Parameters:
stream
- The PST file to read.- Throws:
NotPSTFileException
- The input stream does not contain a PST file.IOException
- There was an I/O error reading the input stream.
-
-
Method Details
-
read
Read data from the given position as a ByteBuffer- Parameters:
position
- The location to read from.length
- The number of bytes to read.- Returns:
- A ByteBuffer providing access to the requested bytes
-
close
Close the PSTFile file.- Throws:
IOException
- There was a problem closing the file.
-
unicode
public boolean unicode()A convenience method to indicate whether the PST file uses Unicode or ANSI encoding.- Returns:
- true if the PST file read in is a Unicode PST file, false if it is ANSI.
- See Also:
FileFormat.fUnicode
-
makeByteBuffer
Create a ByteBuffer with the right byte ordering from the given array.- Parameters:
bytes
- The data to change into a ByteBuffer- Returns:
- A ByteBuffer containing the input data with little-endian order from which PST fields may be read.
-