org.jboss.ejb.protocol.remote.WrapperMessageOutputStream 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.jboss.ejb.protocol.remote;
import java.io.IOException;
import java.io.OutputStream;
import org.jboss.remoting3.MessageOutputStream;
/**
* Extended version of DataOutputStream that does not flush before close
*
* @author Stuart Douglas
*/
class WrapperMessageOutputStream extends MessageOutputStream {
private final MessageOutputStream underlyingMessage;
private final OutputStream delegate;
WrapperMessageOutputStream(MessageOutputStream underlyingMessage, OutputStream delegate) {
this.underlyingMessage = underlyingMessage;
this.delegate = delegate;
}
@Override
public void write(int b) throws IOException {
delegate.write(b);
}
@Override
public void flush() throws IOException {
delegate.flush();
}
@Override
public void close() throws IOException {
delegate.close();
}
@Override
public MessageOutputStream cancel() {
return underlyingMessage.cancel();
}
@Override
public void write(byte[] b) throws IOException {
delegate.write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
delegate.write(b, off, len);
}
}