1 package net.sf.openrocket.android.db;
\r
3 import java.io.ByteArrayInputStream;
\r
4 import java.io.ByteArrayOutputStream;
\r
5 import java.io.ObjectInputStream;
\r
6 import java.io.ObjectOutputStream;
\r
8 import net.sf.openrocket.util.Coordinate;
\r
10 abstract class ConversionUtils {
\r
12 static double[] deserializeArrayOfDouble( byte[] bytes ) throws Exception {
\r
13 double[] data = null;
\r
14 if (bytes != null ) {
\r
15 ObjectInputStream is = new ObjectInputStream( new ByteArrayInputStream(bytes));
\r
16 data = (double[]) is.readObject();
\r
21 static byte[] serializeArrayOfDouble( double[] data ) throws Exception {
\r
23 byte[] serObj = null;
\r
24 if ( data != null ) {
\r
25 ByteArrayOutputStream b = new ByteArrayOutputStream();
\r
26 ObjectOutputStream os = new ObjectOutputStream(b);
\r
27 os.writeObject(data);
\r
29 serObj = b.toByteArray();
\r
34 static Coordinate[] deserializeArrayOfCoordinate( byte[] bytes ) throws Exception {
\r
35 Coordinate[] data = null;
\r
36 if (bytes != null ) {
\r
37 ObjectInputStream is = new ObjectInputStream( new ByteArrayInputStream(bytes));
\r
38 data = (Coordinate[]) is.readObject();
\r
43 static byte[] serializeArrayOfCoordinate( Coordinate[] data ) throws Exception {
\r
45 byte[] serObj = null;
\r
46 if ( data != null ) {
\r
47 ByteArrayOutputStream b = new ByteArrayOutputStream();
\r
48 ObjectOutputStream os = new ObjectOutputStream(b);
\r
49 os.writeObject(data);
\r
51 serObj = b.toByteArray();
\r