使用Message.getInputStream()读取附件信息,速度特别慢,1M的内容要读10几秒,不知道什么原因。是本来就这样吗?我使用了BufferedInputStream和BufferedOutputStream也不行。大家的读取速度如何?谢谢~~~~
解决方案 »
- 【求帮助】初学用java编写一个指纹考勤程序
- Exception sending context initialized event to listener instance of class org.sp
- 小白:封装不同数据库思路……
- WEBMETHODS APPLICATIONS
- ㊣㊣㊣高分求解工作流(WorkFlow)的选择,请各位入内小憩一会儿㊣㊣㊣
- 为什么总是无法用JDBC连上ORACLE
- 关于jboss
- 请大家介绍几本java的好书,最好是ejb,j2ee的,原版英文的也可以!多谢!
- 问几个类似petstore的架构的问题(1)
- weblogic 时间问题
- 关于小数点四舍五入的问题。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
- 如何在同一个Socket连接下让服务器端不停的给客户端发数据,而客户端不停的接收?
p是一个Message,在is.read时,一般要100ms。
BufferedInputStream is = new BufferedInputStream(
p.getInputStream());
BufferedOutputStream baos = new BufferedOutputStream(
new ByteArrayOutputStream());
int size = -1;
do {
byte[] bs = new byte[8192];
size = is.read(bs);
if (size > 0) {
baos.write(bs, 0, size);
baos.flush();
}
} while (size > 0);
myPart.setContent(baos);
parts.add(myPart);
is.close();
baos.close();
javax.mail.Message p; BufferedInputStream is = new BufferedInputStream(
p.getInputStream());
BufferedOutputStream baos = new BufferedOutputStream(
new ByteArrayOutputStream());
int size = -1;
do {
byte[] bs = new byte[8192];
size = is.read(bs);
if (size > 0) {
baos.write(bs, 0, size);
baos.flush();
}
} while (size > 0); myPart.setContent(baos);
parts.add(myPart);
is.close();
baos.close();