org.jboss.ejb.protocol.remote.NoFlushByteOutput 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 org.jboss.marshalling.ByteOutput;
/**
* An output stream that ignores flushes. The marshsaller will flush when it is done, which
* results in two frames on the wire. By ignoring the flush only one frame is sent for
* each message.
*
* @author Stuart Douglas
*/
class NoFlushByteOutput implements ByteOutput {
private final ByteOutput delegate;
NoFlushByteOutput(ByteOutput delegate) {
this.delegate = delegate;
}
@Override
public void write(int b) throws IOException {
delegate.write(b);
}
@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);
}
@Override
public void close() throws IOException {
delegate.close();
}
@Override
public void flush() throws IOException {
//ignore
}
}