use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.
the class NetworkBridgeFilterMarshaller method tightMarshal1.
/**
* Write the booleans that this object uses to a BooleanStream
*/
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter) o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getNetworkBrokerId(), bs);
return rc + 4;
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.
the class NetworkBridgeFilterMarshaller method tightMarshal2.
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
NetworkBridgeFilter info = (NetworkBridgeFilter) o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getNetworkBrokerId(), dataOut, bs);
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.
the class BaseDataStreamMarshaller method looseUnmarsalCachedObject.
protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn) throws IOException {
if (wireFormat.isCacheEnabled()) {
if (dataIn.readBoolean()) {
short index = dataIn.readShort();
DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn);
wireFormat.setInUnmarshallCache(index, object);
return object;
} else {
short index = dataIn.readShort();
return wireFormat.getFromUnmarshallCache(index);
}
} else {
return wireFormat.looseUnmarshalNestedObject(dataIn);
}
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.
the class BaseDataStreamMarshaller method tightUnmarsalCachedObject.
protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
if (wireFormat.isCacheEnabled()) {
if (bs.readBoolean()) {
short index = dataIn.readShort();
DataStructure object = wireFormat.tightUnmarshalNestedObject(dataIn, bs);
wireFormat.setInUnmarshallCache(index, object);
return object;
} else {
short index = dataIn.readShort();
return wireFormat.getFromUnmarshallCache(index);
}
} else {
return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
}
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.
the class OpenWireFormat method looseMarshalNestedObject.
public void looseMarshalNestedObject(DataStructure o, DataByteArrayOutputStream dataOut) throws IOException {
dataOut.writeBoolean(o != null);
if (o != null) {
if (o instanceof Message) {
if (!isTightEncodingEnabled() && !isCacheEnabled()) {
CachedEncodingTrait encoding = ((Message) o).getCachedEncoding();
if (encoding != null && !encoding.tight() && encoding.version() == getVersion()) {
Buffer buffer = encoding.buffer();
dataOut.write(buffer.data, buffer.offset + 4, buffer.length() - 4);
return;
}
}
}
byte type = o.getDataStructureType();
dataOut.writeByte(type);
DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
if (dsm == null) {
throw new IOException("Unknown data type: " + type);
}
dsm.looseMarshal(this, o, dataOut);
}
}
Aggregations