Skip to content

Commit fead2af

Browse files
committed
remove old docs
1 parent 027e8c6 commit fead2af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+78
-27673
lines changed

README.md

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -19,96 +19,102 @@ For example usage of the library please see the TestGui application stored in th
1919

2020
Accessing the contents of a PSTFile is a matter of following the folder structure down to the desired email. This example reads a PST and prints the tree structure to the console:
2121

22-
package example;
23-
import com.pff.*;
24-
import java.util.*;
25-
26-
public class Test {
27-
public static void main(String[] args)
28-
{
29-
new Test(args[0]);
22+
```java
23+
package example;
24+
import com.pff.*;
25+
import java.util.*;
26+
27+
public class Test {
28+
public static void main(String[] args)
29+
{
30+
new Test(args[0]);
31+
}
32+
33+
public Test(String filename) {
34+
try {
35+
PSTFile pstFile = new PSTFile(filename);
36+
System.out.println(pstFile.getMessageStore().getDisplayName());
37+
processFolder(pstFile.getRootFolder());
38+
} catch (Exception err) {
39+
err.printStackTrace();
3040
}
41+
}
3142

32-
public Test(String filename) {
33-
try {
34-
PSTFile pstFile = new PSTFile(filename);
35-
System.out.println(pstFile.getMessageStore().getDisplayName());
36-
processFolder(pstFile.getRootFolder());
37-
} catch (Exception err) {
38-
err.printStackTrace();
43+
int depth = -1;
44+
public void processFolder(PSTFolder folder)
45+
throws PSTException, java.io.IOException
46+
{
47+
depth++;
48+
// the root folder doesn't have a display name
49+
if (depth > 0) {
50+
printDepth();
51+
System.out.println(folder.getDisplayName());
52+
}
53+
54+
// go through the folders...
55+
if (folder.hasSubfolders()) {
56+
Vector<PSTFolder> childFolders = folder.getSubFolders();
57+
for (PSTFolder childFolder : childFolders) {
58+
processFolder(childFolder);
3959
}
4060
}
4161

42-
int depth = -1;
43-
public void processFolder(PSTFolder folder)
44-
throws PSTException, java.io.IOException
45-
{
62+
// and now the emails for this folder
63+
if (folder.getContentCount() > 0) {
4664
depth++;
47-
// the root folder doesn't have a display name
48-
if (depth > 0) {
65+
PSTMessage email = (PSTMessage)folder.getNextChild();
66+
while (email != null) {
4967
printDepth();
50-
System.out.println(folder.getDisplayName());
51-
}
52-
53-
// go through the folders...
54-
if (folder.hasSubfolders()) {
55-
Vector<PSTFolder> childFolders = folder.getSubFolders();
56-
for (PSTFolder childFolder : childFolders) {
57-
processFolder(childFolder);
58-
}
59-
}
60-
61-
// and now the emails for this folder
62-
if (folder.getContentCount() > 0) {
63-
depth++;
64-
PSTMessage email = (PSTMessage)folder.getNextChild();
65-
while (email != null) {
66-
printDepth();
67-
System.out.println("Email: "+email.getSubject());
68-
email = (PSTMessage)folder.getNextChild();
69-
}
70-
depth--;
68+
System.out.println("Email: "+email.getSubject());
69+
email = (PSTMessage)folder.getNextChild();
7170
}
7271
depth--;
7372
}
73+
depth--;
74+
}
7475

75-
public void printDepth() {
76-
for (int x = 0; x < depth-1; x++) {
77-
System.out.print(" | ");
78-
}
79-
System.out.print(" |- ");
76+
public void printDepth() {
77+
for (int x = 0; x < depth-1; x++) {
78+
System.out.print(" | ");
8079
}
80+
System.out.print(" |- ");
8181
}
82+
}
83+
```
8284

8385
Attachments can be read through PSTAttachment.getFileInputStream like so:
8486

85-
int numberOfAttachments = email.getNumberOfAttachments();
86-
for (int x = 0; x < numberOfAttachments; x++) {
87-
PSTAttachment attach = email.getAttachment(x);
88-
InputStream attachmentStream = attach.getFileInputStream();
89-
// both long and short filenames can be used for attachments
90-
String filename = attach.getLongFilename();
91-
if (filename.isEmpty()) {
92-
filename = attach.getFilename();
93-
}
94-
FileOutputStream out = new FileOutputStream(filename);
95-
// 8176 is the block size used internally and should give the best performance
96-
int bufferSize = 8176;
97-
byte[] buffer = new byte[bufferSize];
98-
int count = attachmentStream.read(buffer);
99-
while (count == bufferSize) {
100-
out.write(buffer);
101-
count = attachmentStream.read(buffer);
102-
}
103-
byte[] endBuffer = new byte[count];
104-
System.arraycopy(buffer, 0, endBuffer, 0, count);
105-
out.write(endBuffer);
106-
out.close();
107-
attachmentStream.close();
87+
```java
88+
int numberOfAttachments = email.getNumberOfAttachments();
89+
for (int x = 0; x < numberOfAttachments; x++) {
90+
PSTAttachment attach = email.getAttachment(x);
91+
InputStream attachmentStream = attach.getFileInputStream();
92+
// both long and short filenames can be used for attachments
93+
String filename = attach.getLongFilename();
94+
if (filename.isEmpty()) {
95+
filename = attach.getFilename();
96+
}
97+
FileOutputStream out = new FileOutputStream(filename);
98+
// 8176 is the block size used internally and should give the best performance
99+
int bufferSize = 8176;
100+
byte[] buffer = new byte[bufferSize];
101+
int count = attachmentStream.read(buffer);
102+
while (count == bufferSize) {
103+
out.write(buffer);
104+
count = attachmentStream.read(buffer);
108105
}
106+
byte[] endBuffer = new byte[count];
107+
System.arraycopy(buffer, 0, endBuffer, 0, count);
108+
out.write(endBuffer);
109+
out.close();
110+
attachmentStream.close();
111+
}
112+
```
109113

110114
Each object in the PST has a unique identifier called a descriptor node id. This can be useful for retrieving known objects quickly from the PST:
111115

112-
long id = email.getDescriptorNodeId();
113-
pstObject = PSTObject.detectAndLoadPSTObject(pstFile, id);
116+
```java
117+
long id = email.getDescriptorNodeId();
118+
pstObject = PSTObject.detectAndLoadPSTObject(pstFile, id);
119+
```
114120

javadoc/allclasses-frame.html

Lines changed: 0 additions & 72 deletions
This file was deleted.

javadoc/allclasses-noframe.html

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)