------解决方案-------------------- 可以利用jfreechart提供的ChartUtilities.writeChartAsJPEG(OutputStream out, JFreeChart chart, int width, int height);你这里要转成byte[]你可以用ByteArrayOutputStream来替代这个out在利用ByteArrayOutputStream的toByteArray()转成byte[]就行了
------解决方案--------------------
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(p1);
oos.close();
baos.close();
byte[] data = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(data);
ObjectInputStream ois = new ObjectInputStream(bais);