Binary data is the fastest way. Class Java.IO.DataOutputStream &
java.io.DataInputStream are the best classes to use to store data into your
own proprietary format. To share your data with other apps, .3ds file format
is one of the most widely used but, complex for beginners. The .obj text
format is the easiest to read/write to since it is simply ascii. There will
be overhead in parsing huge .obj files. But, that is a very popular format
as well. You can also use Serialization which automates a lot but, be very
careful if go that route.
Code snippet from my PrimitiveWriter.java Example:
try {
FileOutputStream ostream = new
FileOutputStream("primitives.tmp");
DataOutputStream dos = new DataOutputStream(ostream);
dos.writeUTF("Kreation's Edge rules!"); //Write
Unicode Format for strings....
dos.writeInt(66);
dos.writeInt(77);
dos.flush();
ostream.close();
} catch (Exception e) {
System.out.println(e);
}
System.out.println("Reading Binary File....");
try {
FileInputStream ostream = new
FileInputStream("primitives.tmp");
DataInputStream dos = new DataInputStream(ostream);
System.out.println(dos.readUTF()); //Expect a
Unicode Format String
System.out.println(dos.readInt());
System.out.println(dos.readInt());
ostream.close();
} catch (Exception e) {
System.out.println(e);
}
Richard Osborne
F.E.B.A. for UT, Project Lead
http://www.cyberkreations.com/kreationsedge
-----Original Message-----
From: Sachin Myneni [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2000 7:31 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Reading values of type double from a file
Hi Everyone,
I have recently joined this mailing list (and infact
recently
started using JAVA). I am developing a software which involves a
HUGE number
of vertices. These vertices are divided into groups. That is, each
set
represents a plane. Each of these planes have to be transformed
(rotation
and translation).
* I have to read this vertices from a file, and I am not able
to
figure out which java.io classes and methods, should I use to read
these
"double" values from a file into an array (arrayList maybe???).
* What is the best way to store these points? The total number
of
points do not change (till I am ready to write them into a file
after some
calculation) and I frequently need to pull out these points
sequentially.
Any suggestion would be a huge help. And could someone point
me
towards a book/resource which deals in examples with reading/storing
geometric data?
Thanks
-Sachin
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in
the body
of the message "signoff JAVA3D-INTEREST". For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".