对象转为字节数组
2013-10-22 09:00
260 查看
public static byte[] convertToByteArray(Object obj) throws IOException { ObjectOutputStream os = null; ByteArrayOutputStream byteStream = new ByteArrayOutputStream(5000); os = new ObjectOutputStream(new BufferedOutputStream(byteStream)); os.flush(); os.writeObject(obj); os.flush(); byte[] sendBuf = byteStream.toByteArray(); os.close(); return sendBuf; }
View Code
相关文章推荐
- eclipse不能创建service
- 项目管理的基础运作、操作以及视角
- windows下使用C#获取特定进程网络流量
- GridView中采用来LinkButton修改表格中的数据(绑定数据在TextBox中)
- Java中instanceof关键字的用法总结
- Android利用Fiddler进行网络数据抓包
- Java Project和Web Project 区别
- 情感分析资源 (转)
- windows下mysql数据库安装(每一步都有截图和说明)
- windows、linux文件转换
- 委托 你怎么看?
- 拓展,三个数比较大小
- //手机网页监控所有对象按下的样式
- 表达式语言的内置对象
- 一句话 手机页中按钮去点击背景
- OCP-1Z0-051-V9.02-8题
- 采集Snoopy.class.php
- 看山不是山,看水不是水
- 进程与线程的区别和联系
- SpringMVC 利用AbstractRoutingDataSource实现动态数据源切换