Hi.
I have a class whose structure is similar to a TCP packet ( packet header, packet data)
So i want to read first packet's data(in order to read data's size in bytes) and then fill the packet's header.
To do this i have to seek into the stream forward (to the packet's data start point) and then backward (to the packet's start point).
I have this application in C# and the code for seeking looks like this
BinaryWriter writer = new BinaryWriter(mBuffer);
writer.Seek(0, SeekOrigin.Begin);
where mBuffer is a MemoryStream object;
To adapt it in java i have made these convertions:
MemoryStream converted to ByteArrayOutputStream.
BinaryWriter converted to
BufferedOutputStream bos = new BufferedOutputStream(mBuffer);
DataOutputStream writer=new DataOutputStream(bos);
where mBuffer is a ByteArrayOutputStream object;
Searching the java API i didn't found any seek method in class DataOutputStream neither to it's super classes in java.io hierarchy.
So how can i seek forward and backward in ByteArrayOutputStream and ByteArrayInputStream objects?