The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

getSize() is wrong

Posted by ping203 on December 20, 2001 at 3:34 PM

Hi,

int + int + Sting + double
= 4 + 4 + (length-15) + 8
= 31
however, since you are using writeChars(String), Java writes it as 2-byte (Writes a char to the file as a two-byte value, high byte first. see the API for writeChar)
therefore, the getSize() should return
4 + 4 + 15*2 + 8
= 46



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us