source: osm/applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedSequentialInStreamImp.java@ 29679

Last change on this file since 29679 was 29679, checked in by donvip, 11 years ago

[josm_opendata] Add .7z archive read support

File size: 1.0 KB
Line 
1package org.j7zip.Common;
2
3public class LockedSequentialInStreamImp extends java.io.InputStream {
4 LockedInStream _lockedInStream;
5 long _pos;
6
7 public LockedSequentialInStreamImp() {
8 }
9
10 public void Init(LockedInStream lockedInStream, long startPos) {
11 _lockedInStream = lockedInStream;
12 _pos = startPos;
13 }
14
15 public int read() throws java.io.IOException {
16 throw new java.io.IOException("LockedSequentialInStreamImp : read() not implemented");
17 /*
18 int ret = _lockedInStream.read(_pos);
19 if (ret == -1) return -1; // EOF
20
21 _pos += 1;
22
23 return ret;
24 */
25 }
26
27 public int read(byte [] data, int off, int size) throws java.io.IOException {
28 int realProcessedSize = _lockedInStream.read(_pos, data,off, size);
29 if (realProcessedSize == -1) return -1; // EOF
30
31 _pos += realProcessedSize;
32
33 return realProcessedSize;
34 }
35
36}
Note: See TracBrowser for help on using the repository browser.