is there a class for buffer storage? maybe like ArrayList?
Hi.
Say I'm building a ZIP file, the ZIP file has a header of UInt32 0x04034b50 then some 2-byte tags, short 0x0A00, and another short.
How can i save these:
uint part1=0x04034b50;
ushort part2=0x0a00;
ushort part3=0;
I can't put then into an ArrayList because they are of different type.
In the end I want to extract the arraylist and put into a byte[].
AnttiPosted Feb 21, 2006, 5:49 AM
Rob JonesPosted Feb 20, 2006, 5:43 PM
AnttiPosted Feb 19, 2006, 3:02 PM
You could write the values to the byte array using BinaryWriter and MemoryStream. First, create your byte array buffer with some good size. Then create MemoryStream object, and use your buffer as a constructor parameter. Then create BinaryWriter, and pass the memory stream to it.
Now You can write many sorts of information to the byte array buffer, with BinaryWriter's Write -methods.
byte[] buffer = new byte[256];MemoryStream stream = new MemoryStream(buffer);
BinaryWriter writer = new BinaryWriter(stream);
writer.Write("somevalues");