The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 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:

Delphi progammer needs help with packed records

Posted by barn on February 14, 2001 at 11:37 AM

Hello

I'm a Delphi programmer thats just started with Java and I'm trying to figure out if theres a Java equivalent of Delphi's blockread/blockwrite (or C's readFile() from winbase.h?)

I want to write a program in java to read from a flatfile created in Delphi.

The delphi prog writes a record of the form

TItem_Rec = packed record
code : integer;
desc : array[0..16] of char;
...
end;
...

using

BlockWrite(aFile,pItem_Rec(Items[i])^,SizeOf(TItem_Rec),num);

and can read it later using

BlockRead(f,anItem^,SizeOf(TItem_Rec), numRead);

Is there any other way of doing it in java than (say) the readInt() method in RandomAccessFile, followed by readChar(), followed by readChar(), etc etc. Can I create a TItem_Rec class and read the file directly into that?

Thanks



Replies:

Sponsored Links



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