org.jgroups.util.InputStreamAdapter Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.util;
import java.io.IOException;
import java.io.InputStream;
/**
* Extends {@link InputStream} from a {@link ByteArrayDataInputStream}. Methods like flush() and close() are no-ops.
* @author Bela Ban
* @since 3.5
*/
public class InputStreamAdapter extends InputStream {
protected final ByteArrayDataInputStream input;
public InputStreamAdapter(ByteArrayDataInputStream input) {
this.input=input;
}
public int read() throws IOException {
return input.read();
}
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
public int read(byte[] b, int off, int len) throws IOException {
return input.read(b, off, len);
}
public long skip(long n) throws IOException {
return input.skipBytes((int)n);
}
public int available() throws IOException {
return input.limit() - input.position();
}
public void close() throws IOException {
;
}
public void reset() throws IOException {
;
}
public boolean markSupported() {
return false;
}
}