public int getContent(long messageId, int offset, ByteBuffer dst) throws AMQStoreException
{
DatabaseEntry contentKeyEntry = new DatabaseEntry();
LongBinding.longToEntry(messageId, contentKeyEntry);
DatabaseEntry value = new DatabaseEntry();
ContentBinding contentTupleBinding = ContentBinding.getInstance();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Message Id: " + messageId + " Getting content body from offset: " + offset);
}
try
{
int written = 0;
OperationStatus status = _messageContentDb.get(null, contentKeyEntry, value, LockMode.READ_UNCOMMITTED);
if (status == OperationStatus.SUCCESS)
{
byte[] dataAsBytes = contentTupleBinding.entryToObject(value);
int size = dataAsBytes.length;
if (offset > size)
{
throw new RuntimeException("Offset " + offset + " is greater than message size " + size
+ " for message id " + messageId + "!");