binary file search fixed

This commit is contained in:
Honfika
2014-01-21 23:33:06 +01:00
parent 7b518a6e0d
commit 043b4c12da
5 changed files with 49 additions and 81 deletions
@@ -29,10 +29,10 @@ import java.util.logging.Logger;
*/
public class StreamSearch implements Searchable {
private final ReReadableInputStream is;
private final MemoryInputStream is;
public StreamSearch(InputStream is) {
this.is = new ReReadableInputStream(is);
this.is = new MemoryInputStream(Helper.readStream(is));
}
@Override
@@ -83,7 +83,8 @@ public class StreamSearch implements Searchable {
}
}
if (match) {
InputStream fis = new FoundInputStream(pos + i, is);
// todo: support > 2GB files
InputStream fis = new MemoryInputStream(is.getAllRead(), (int) pos + i);
ret.put(pos + i, fis);
continue loopdata;
}