我有形状数组:
Shape[] myshape = new Shape[13];
我如何将其保存到文件中?
我找到了一些代码:
String fileName = "file.test";
BufferedOutputStream bs = null;
try {
FileOutputStream fs = new FileOutputStream(new File(fileName));
bs = new BufferedOutputStream(fs);
bs.write(byte_array);
bs.close();
bs = null;
} catch (Exception e) {
e.printStackTrace()
}
if (bs != null) try { bs.close(); } catch (Exception e) {}
但是代码仅适用于字节数组,任何人都可以帮助我吗?