Re: Vector<T> length in bytes
- From: Mark Space <markspace@xxxxxxxxxxxxxx>
- Date: Thu, 03 Apr 2008 01:55:33 GMT
ivan.kataitsev@xxxxxxxxx wrote:
=) Mark, thank u for your help, but in context of my task i need to
know exactly the "length" in bytes, not memory allocation of byte[].
After some actions all data will be send to the some output stream anf
Andrea and Lew are both right. You basically have to do this yourself. Even in C, you have some questions about what exactly you are going to measure the size of. An array of pointers is likely to be much smaller than the buffers it points to, but that would be the size of the array. The buffers OTOH are probably what you want transmit, but if you used a general memory counting algorithm, you'd likely have the size of the array of pointers included.
It won't work as you imagine, in any language. An image of memory is not dumped on the wire and then read by the other end. At least, I think that would be incredibly hard to maintain.
You'll need to define the problem a bit better. Andrea's suggestion isn't bad, especially if you have a disk you can spool to, or you're sure that you can hold all your buffers in memory.
You might also try to send each object in the Vector separately. That might be easier than trying to mash them all together first. HTTP does this when sending pages. First the HTML is sent, then the images are loaded one at a time. It's not one huge bundle.
Better yet would be to use a protocol that does not require you to know the size before you send, but that may not be an option if you are trying to send a single GIF or something. However, I'll mention that I think using Java's serialization directly does do this--you don't need the total number of bytes before you start sending. It might be an option.
Anyway, good luck. Let us know if you work it out.
.
- References:
- Vector<T> length in bytes
- From: ivan . kataitsev
- Re: Vector<T> length in bytes
- From: Mark Space
- Re: Vector<T> length in bytes
- From: ivan . kataitsev
- Re: Vector<T> length in bytes
- From: Mark Space
- Re: Vector<T> length in bytes
- From: ivan . kataitsev
- Vector<T> length in bytes
- Prev by Date: Re: File.owner
- Next by Date: using HSSF and POI with Java
- Previous by thread: Re: Vector<T> length in bytes
- Next by thread: Re: Vector<T> length in bytes
- Index(es):
Relevant Pages
|
Loading