
org.jamel.j7zip.common.SequentialOutStreamImp2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of j7zip Show documentation
Show all versions of j7zip Show documentation
Java library for fast reading DBF-files
The newest version!
package org.jamel.j7zip.common;
public class SequentialOutStreamImp2 extends java.io.OutputStream {
private final byte[] buffer;
private final int size;
private int pos;
public SequentialOutStreamImp2(byte[] buffer, int size) {
this.buffer = buffer;
this.size = size;
}
public void write(int b) throws java.io.IOException {
throw new java.io.IOException("SequentialOutStreamImp2 - write() not implemented");
}
public void write(byte[] data, int off, int size) throws java.io.IOException {
for (int i = 0; i < size; i++) {
if (pos < this.size) {
buffer[pos++] = data[off + i];
} else {
throw new java.io.IOException("SequentialOutStreamImp2 - can't write");
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy