{
int msgType = rs.getInt(2);
String msgId = rs.getString(3);
boolean redelivered = rs.getInt(4) == 1;
MessageImpl msg;
switch (msgType) {
case TEXT:
{
InputStream is = rs.getBinaryStream(5);
try {
msg = readTextMessage(is);
} finally {
if (is != null)
is.close();
}
break;
}
case BYTES:
{
InputStream is = rs.getBinaryStream(5);
try {
msg = readBytesMessage(is);
} finally {
if (is != null)
is.close();
}
break;
}
case STREAM:
{
InputStream is = rs.getBinaryStream(5);
try {
msg = readStreamMessage(is);
} finally {
if (is != null)
is.close();
}
break;
}
case OBJECT:
{
InputStream is = rs.getBinaryStream(5);
try {
msg = readObjectMessage(is);
} finally {
if (is != null)
is.close();
}
break;
}
case MAP:
{
InputStream is = rs.getBinaryStream(5);
try {
msg = readMapMessage(is);
} finally {
if (is != null)
is.close();
}
break;
}
case MESSAGE:
default:
{
msg = new MessageImpl();
break;
}
}
InputStream is = rs.getBinaryStream(6);
if (is != null) {
try {
readMessageHeader(is, msg);
} finally {
is.close();
}
}
msg.setJMSMessageID(msgId);
msg.setJMSRedelivered(redelivered);
return msg;
}