blob: 7bdfcde16a4ce5c12b3b4ff2258b7b299f31388b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package com.xagasoft.gats;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
public class GatsOutputStream
{
private OutputStream os;
public GatsOutputStream( OutputStream os )
{
this.os = os;
}
public void writeObject( GatsObject obj ) throws java.io.IOException
{
ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
obj.write( bos1 );
ByteArrayOutputStream bos2 = new ByteArrayOutputStream(
5 + bos1.size()
);
DataOutputStream dos = new DataOutputStream( bos2 );
dos.writeByte( 1 );
dos.writeInt( bos1.size()+5 );
bos2.write( bos1.toByteArray() );
os.write( bos2.toByteArray() );
}
};
|