-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathPSTFileContent.java
More file actions
37 lines (28 loc) · 1.04 KB
/
PSTFileContent.java
File metadata and controls
37 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.pff;
import java.io.IOException;
public abstract class PSTFileContent {
public abstract void seek(long index) throws IOException;
public abstract long getFilePointer() throws IOException;
public abstract int read() throws IOException;
public abstract int read(byte[] target) throws IOException;
public final void readCompletely(final byte[] target) throws IOException {
int read = this.read(target);
// bail in common case
if (read <= 0 || read == target.length) {
return;
}
byte[] buffer = new byte[8192];
int offset = read;
while (offset < target.length) {
read = this.read(buffer);
if (read <= 0) {
break;
}
int length = Math.min(read, target.length - offset);
System.arraycopy(buffer, 0, target, offset, length);
offset += length;
}
}
public abstract byte readByte() throws IOException;
public abstract void close() throws IOException;
}