Skip to content

Commit

Permalink
added getPrefix()-function to PBO.java; increased performance of PBOI…
Browse files Browse the repository at this point in the history
…nputStream.java tremendously
  • Loading branch information
Krzmbrzl committed Sep 21, 2018
1 parent 58b72bd commit 05c6a20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 23 additions & 0 deletions ArmaFiles/src/raven/pbo/PBO.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,27 @@ public PBOEntry getEntry(String name) {
return null;
}

/**
* Gets the prefix for this PBO or <code>null</code> if there is none
*/
public String getPrefix() {
if (headerExtension == null || headerExtension.length < 2) {
return null;
}

for (int i = 0; i < headerExtension.length - 1; i++) {
String current = headerExtension[i];

if (current == null) {
return null;
}

if (current.toLowerCase().equals("prefix")) {
return headerExtension[i + 1];
}
}

return null;
}

}
4 changes: 1 addition & 3 deletions ArmaFiles/src/raven/pbo/PBOInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public PBOInputStream(PBOEntry entry) throws IOException {
* @throws IOException
*/
protected void pointStream() throws IOException {
for (int i = 0; i < entry.getStartOffset(); i++) {
internalStream.read();
}
internalStream.getChannel().position(entry.getStartOffset());
}

@Override
Expand Down

0 comments on commit 05c6a20

Please sign in to comment.