mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 17:14:25 +02:00
MemoryDataStore: Support InputStream mark/reset
This commit is contained in:
parent
b9a725e726
commit
c41c24a0c2
@ -70,6 +70,7 @@ public class MemoryDataStore implements DexDataStore {
|
||||
@Nonnull @Override public InputStream readAt(final int offset) {
|
||||
return new InputStream() {
|
||||
private int position = offset;
|
||||
private int mark = offset;
|
||||
|
||||
@Override public int read() throws IOException {
|
||||
if (position >= size) {
|
||||
@ -113,6 +114,18 @@ public class MemoryDataStore implements DexDataStore {
|
||||
@Override public int available() throws IOException {
|
||||
return Math.max(0, size - position);
|
||||
}
|
||||
|
||||
@Override public void mark(int i) {
|
||||
mark = position;
|
||||
}
|
||||
|
||||
@Override public void reset() throws IOException {
|
||||
position = mark;
|
||||
}
|
||||
|
||||
@Override public boolean markSupported() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user