src/net/java/otr4j/io/SerializationUtils.java
changeset 1017 377cc9bcfdaa
parent 916 b2e1b45382a4
equal deleted inserted replaced
1016:c337d8c387f5 1017:377cc9bcfdaa
    73 	public static byte[] toByteArray(MysteriousT t) throws IOException {
    73 	public static byte[] toByteArray(MysteriousT t) throws IOException {
    74 		ByteArrayOutputStream out = new ByteArrayOutputStream();
    74 		ByteArrayOutputStream out = new ByteArrayOutputStream();
    75 		OtrOutputStream oos = new OtrOutputStream(out);
    75 		OtrOutputStream oos = new OtrOutputStream(out);
    76 		oos.writeMysteriousT(t);
    76 		oos.writeMysteriousT(t);
    77 		byte[] b = out.toByteArray();
    77 		byte[] b = out.toByteArray();
    78 		out.close();
    78 		oos.close();
    79 		return b;
    79 		return b;
    80 	}
    80 	}
    81 
    81 
    82 	// Basic IO.
    82 	// Basic IO.
    83 	public static byte[] writeData(byte[] b) throws IOException {
    83 	public static byte[] writeData(byte[] b) throws IOException {
    84 		ByteArrayOutputStream out = new ByteArrayOutputStream();
    84 		ByteArrayOutputStream out = new ByteArrayOutputStream();
    85 		OtrOutputStream oos = new OtrOutputStream(out);
    85 		OtrOutputStream oos = new OtrOutputStream(out);
    86 		oos.writeData(b);
    86 		oos.writeData(b);
    87 		byte[] otrb = out.toByteArray();
    87 		byte[] otrb = out.toByteArray();
    88 		out.close();
    88 		oos.close();
    89 		return otrb;
    89 		return otrb;
    90 	}
    90 	}
    91 
    91 
    92 	// BigInteger IO.
    92 	// BigInteger IO.
    93 	public static byte[] writeMpi(BigInteger bigInt) throws IOException {
    93 	public static byte[] writeMpi(BigInteger bigInt) throws IOException {