62,614
社区成员
发帖
与我相关
我的任务
分享
/**
*
* @param str
* @return <字符串转换流的形式>
*/
public InputStream convertToInputStream(String str)
{
ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes());
return is;
}
//保存数据库中
byte[] b = new byte[is.available()];
infoRelease.setNewsContent(b);
//存入数据库的时候
String s = myform.getString("newsContent");//从form中取出字符串(即中文文字)
InputStream is = new ByteArrayInputStream(s.getBytes()); //转换成流的形式
byte[] b;
try {
b = new byte[is.available()]; //转换成二进制流
infoRelease.setNewsContent(b); //存入数据库了
} catch (IOException e) {
// TODO Auto-generated catch block
}
//从数据库中取出该表单条记录
InfoRelease infoRelease = (InfoRelease) infoObjectMap.get("return_Data");
//取出字段NewsContent 所对应的字节流
byte[] bt = infoRelease.getNewsContent();
{
//这里如何转化~~~
}