定义byte[] buffer时指定为file.getSize()的长度
解决方案 »
- 学习框架《轻量级Java EE企业应用实战》这书咋样?
- 急急急……求助 org.xml.sax.SAXParseException
- Hibernate 真的很差劲,我都快疯掉了
- 急问关于action forward问题~~在线等待~
- java代码中得到存储过程的内容
- 奇怪问题:Unknown terminal field
- 我公司叫我下星期跟个公司内部mis开发,struts,torque和cvs这三种技术,有经验的给我点提示好吗?
- 人才需求
- 我是新手,请各位大虾推荐几本JSP和SERVLET的书或文章吧!
- action可以注入service但是不能输入dao,求解啊
- 用JAVA代码读取ACCESS数据库中的OLE字段的内容,该怎么写代码?
- 我的JSP页面怎么显示部出来日期:请教各位
MyClass o = new MyClass();
o.setProp(1);
o.setProps(new int[]{1, 2, 3});
try {
// Serialize object into XML
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
new FileOutputStream("outfilename.xml")));
encoder.writeObject(o);
encoder.close();
} catch (FileNotFoundException e) {
} // This class defines two properties - prop and props
public class MyClass {
// The prop property
int i;
public int getProp() {
return i;
}
public void setProp(int i) {
this.i = i;
}
// The props property
int[] iarray = new int[0];
public int[] getProps() {
return iarray;
}
public void setProps(int[] iarray) {
this.iarray = iarray;
}
}