如何从MySql数据库longblob型的数据?其读入数据库的方法如下:
ByteArrayOutputStream headerOut = new ByteArrayOutputStream();
OutputStream bodyOut = null;
try {
if (sr == null) {
//If there is no sr, then use the same byte array to hold the headers
// and the body
bodyOut = headerOut;
} else {
//Store the body in the file system.
bodyOut = sr.put(mc.getName());
}
//Write the message to the headerOut and bodyOut. bodyOut goes straight to the file
MimeMessageWrapper.writeTo(messageBody, headerOut, bodyOut); ByteArrayInputStream headerInputStream =
new ByteArrayInputStream(headerOut.toByteArray());
insertMessage.setBinaryStream(10, headerInputStream, headerOut.size());
这个就是James中写邮件信息的方法。我如何能读出来?请大家帮忙!谢谢!!
ByteArrayOutputStream headerOut = new ByteArrayOutputStream();
OutputStream bodyOut = null;
try {
if (sr == null) {
//If there is no sr, then use the same byte array to hold the headers
// and the body
bodyOut = headerOut;
} else {
//Store the body in the file system.
bodyOut = sr.put(mc.getName());
}
//Write the message to the headerOut and bodyOut. bodyOut goes straight to the file
MimeMessageWrapper.writeTo(messageBody, headerOut, bodyOut); ByteArrayInputStream headerInputStream =
new ByteArrayInputStream(headerOut.toByteArray());
insertMessage.setBinaryStream(10, headerInputStream, headerOut.size());
这个就是James中写邮件信息的方法。我如何能读出来?请大家帮忙!谢谢!!
byte[] bytes=blob.getBytes(1,(int)(blob.length()));
你想得到的文本=new String(bytes);