Reading isn't much of a problem if you can get the data in a DXF or OBJ, or
VRML format beforehand.
Writing is tougher, there are curently no export classes to support standard
formats. I personally had to write my own exporter for the last project I
worked on, and it only produced raw triangle format files (.RAW).
Creating a reader for .RAW files wouldn't be much of a problem either.
Even if your data isn't in a standard format, writing a filereader isn't
hard at all as long as you know exactly what you're reading.
Is your data in ASCII format?
Do you know the structure of the data file?
Here's a set of file reader/writer methods which save to and read from files
(containg non ASCII integers ) to and from a pair of arrays of textboxes.
(the number of textboxes doesn't change, so I don't have to keep track of
where the topOven & botOven int's are in the file)
public void saveFile()
{
fileDialog.setMode(fileDialog.SAVE);
fileDialog.show();
if(directory != null){fileDialog.setDirectory(directory); };
file = new File(fileDialog.getFile());
try
{
FileOutputStream outputStream = new
FileOutputStream(file);
for(int t=0;
t<java.lang.reflect.Array.getLength(topOven);t++)
{
outputStream.write(
Integer.parseInt(topOven[t].getText().trim()));
};
for(int t=0;
t<java.lang.reflect.Array.getLength(botOven);t++)
{
outputStream.write(
Integer.parseInt(botOven[t].getText().trim()));
};
outputStream.close();
}
catch (Exception e){};
};
public void openFile()
{
fileDialog.setMode(fileDialog.LOAD);
fileDialog.show();
file = new File(fileDialog.getFile());
directory = new File(fileDialog.getDirectory());
try
{
FileInputStream inputStream = new
FileInputStream(file);
for(int t=0;
t<java.lang.reflect.Array.getLength(topOven);t++)
{
topOven[t].setText(Integer.toString(inputStream.read()));
[..... more processing here that's not related.....]
};
for(int t=0;
t<java.lang.reflect.Array.getLength(botOven);t++)
{
botOven[t].setText(Integer.toString(inputStream.read()));
[..... more processing here that's not related.....]
};
inputStream.close();
}
catch (Exception e){};
};
-----Original Message-----
From: Sachin Myneni [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2000 8: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".