use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.CachedEncodingTrait 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