source: osm/applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/SequentialOutStreamImp2.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: 817 bytes
Line 
1package org.j7zip.SevenZip.Common;
2
3
4public class SequentialOutStreamImp2 extends java.io.OutputStream {
5 byte []_buffer;
6 int _size;
7 int _pos;
8 public void Init(byte [] buffer, int size) {
9 _buffer = buffer;
10 _pos = 0;
11 _size = size;
12 }
13
14 public void write(int b) throws java.io.IOException {
15 throw new java.io.IOException("SequentialOutStreamImp2 - write() not implemented");
16 }
17
18 public void write(byte [] data,int off, int size) throws java.io.IOException {
19 for(int i = 0 ; i < size ; i++) {
20 if (_pos < _size) {
21 _buffer[_pos++] = data[off + i];
22 } else {
23 throw new java.io.IOException("SequentialOutStreamImp2 - can't write");
24 }
25 }
26 }
27}
28
Note: See TracBrowser for help on using the repository browser.