2 * Created on Sep 28, 2005
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package diku
.distlab
.motecontrolclientlib
.protocols
;
9 import java
.io
.ByteArrayInputStream
;
10 import java
.io
.ByteArrayOutputStream
;
11 import java
.io
.DataInput
;
12 import java
.io
.DataOutput
;
13 import java
.io
.DataInputStream
;
14 import java
.io
.DataOutputStream
;
18 * TODO To change the template for this generated type comment go to
19 * Window - Preferences - Java - Code Style - Code Templates
21 abstract public class MsgIO
{
22 public byte[] getBytes() throws Exception
24 ByteArrayOutputStream bos
= new ByteArrayOutputStream();
25 DataOutputStream os
= new DataOutputStream(bos
);
27 return bos
.toByteArray();
30 public void setBytes(byte[] bytes
) throws Exception
32 ByteArrayInputStream bis
= new ByteArrayInputStream(bytes
);
33 DataInputStream is
= new DataInputStream(bis
);
37 abstract public void read(DataInput is
) throws Exception
;
39 abstract public void write(DataOutput os
) throws Exception
;