[4012] in java-interest

home help back first fref pref prev next nref lref last post

Re: sizeof() operation

daemon@ATHENA.MIT.EDU (Elliotte Rusty Harold)
Thu Dec 7 12:20:42 1995

From: "Elliotte Rusty Harold" <Elliotte@blackstar.com>
To: java-interest@java.sun.com
Date:          Thu, 7 Dec 1995 10:05:56 EST
Reply-To: elliotte@blackstar.com
Cc: George E Crawford <gec2@Ra.MsState.Edu>
X-Confirm-Reading-To: elliotte@blackstar.com


> Is there an equivalence of a sizeof() operation in Java? For
> example, file.skipBytes(sizeof(int)*16);

sizeof isn't necessary in Java because all sizes are precisely 
defined. i.e. an int is always 4 bytes. In the example you cite just 
use file.skipBytes(4*16).

This may not seem to be adequate when dealing with objects that 
aren't base data types.  However even if you did know  the size of 
a particular object,  you couldn't do anything with it anyway.
 There's no copy or serialize method in the  Object class so  there's no 
reason to need that information. This is all part of Java separating 
you from physical memory.

--
Elliotte Rusty Harold    Black Star Publishing Co., Inc.
elliotte@blackstar.com   116 East 27th Street
elharo@shock.njit.edu    NY NY 10016
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post