use of org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.ConvertedContentAndMimeType in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10 method convertToStoredMessage.
private StoredMessage<MessageMetaData_0_10> convertToStoredMessage(final Message_1_0 serverMsg, final NamedAddressSpace addressSpace) {
final ConvertedContentAndMimeType convertedContentAndMimeType = getAmqp0xConvertedContentAndMimeType(serverMsg);
final byte[] convertedContent = convertedContentAndMimeType.getContent();
final MessageMetaData_0_10 messageMetaData_0_10 = convertMetaData(serverMsg, addressSpace, convertedContentAndMimeType.getMimeType(), convertedContent.length);
final int metadataSize = messageMetaData_0_10.getStorableSize();
return new StoredMessage<MessageMetaData_0_10>() {
@Override
public MessageMetaData_0_10 getMetaData() {
return messageMetaData_0_10;
}
@Override
public long getMessageNumber() {
return serverMsg.getMessageNumber();
}
@Override
public QpidByteBuffer getContent(final int offset, final int length) {
return QpidByteBuffer.wrap(convertedContent, offset, length);
}
@Override
public int getContentSize() {
return convertedContent.length;
}
@Override
public int getMetadataSize() {
return metadataSize;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public boolean isInMemory() {
return true;
}
@Override
public boolean flowToDisk() {
return false;
}
@Override
public void reallocate() {
}
};
}
use of org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.ConvertedContentAndMimeType in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8 method convertToStoredMessage.
private StoredMessage<MessageMetaData> convertToStoredMessage(final Message_1_0 serverMsg, final NamedAddressSpace addressSpace) {
final ConvertedContentAndMimeType convertedContentAndMimeType = getAmqp0xConvertedContentAndMimeType(serverMsg);
final byte[] convertedContent = convertedContentAndMimeType.getContent();
final MessageMetaData messageMetaData_0_8 = convertMetaData(serverMsg, convertedContentAndMimeType.getMimeType(), convertedContent.length, addressSpace);
final int metadataSize = messageMetaData_0_8.getStorableSize();
return new StoredMessage<MessageMetaData>() {
@Override
public MessageMetaData getMetaData() {
return messageMetaData_0_8;
}
@Override
public long getMessageNumber() {
return serverMsg.getMessageNumber();
}
@Override
public QpidByteBuffer getContent(final int offset, final int length) {
return QpidByteBuffer.wrap(convertedContent, offset, length);
}
@Override
public int getContentSize() {
return convertedContent.length;
}
@Override
public int getMetadataSize() {
return metadataSize;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public boolean isInMemory() {
return true;
}
@Override
public boolean flowToDisk() {
return false;
}
@Override
public void reallocate() {
}
};
}
Aggregations