I went ahead and wrote a Spartan binary file reader. Jmol now reads 
binary ".spartan" files. Any other file in compound document format 
should be no problem as well. I'll answer my own questions below, for 
the record.

Jeff, I thought you might be interested, since we had talked some about 
our reading isosurface data from Spartan files. That's no longer 
necessary, because Jmol can use the basis/MO information to construct 
its own without the need of the cube data present in the Spartan files.

See http://www.stolaf.edu/people/hansonr/jmol/test/proto/new.htm

Bob

Bob Hanson wrote:

>OK, I think the method is so simple, I should implement a binary 
>compound document file reader. It's only about six methods and two short 
>data structures. So here's the idea:
>
>Resolver.java:
>
>Check for the 8-byte "magic number" that the file starts with -- I'm 
>doing this already. If it is found, open the compound document and read 
>the directory. The presence of a document called "Property Archive"  
>will indicate this is a Spartan file.
>
>Read the two documents Archive and Property Archive into a string 
>buffer, close the file, and pass that string buffer on to the 
>SpartanReader, which is already set to read the archive this way.
>
>  
>
this was not necessary. It was cleaner to treat the compound documents 
like gzip files and preprocess them in FileManager.

>I imagine a very small class, "CompoundDocument", that you pass an input 
>stream to, and it does the rest.
>
>  
>
CompoundDocument  is now a class of Viewer, accompanying FileManager there.

>Q: What's the easiest way to read binary from our "buffered reader" we 
>are setting up now?
>
>  
>
Easiest way I found was to treat it as a DataInputStream. I also 
experimented with RandomAccessFile, and that worked nicely, especially 
since it has seek(), but I got caught by the fact that Java applets must 
stream -- no random access. So that bit of code is there, but it's 
commented out. It appears to be fast enough.



>Q: Can you read binary from a buffered reader by wrapping it some way or 
>another?
>  
>

DataInputStream works nicely, with a bit of littleEndian --> bigEndian 
conversions.

>Q: Totally different, better approach?
>
>  
>
There is probably a more efficient way of doing this. But part of the 
trick is that one must read randomly, I think. There's no guarantee that 
the file sectors will be in any order whatsoever.

Bob

>Bob
>
>
>
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Jmol-developers mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>  
>



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to