[x3d-public] X3DJSAIL update: toGZIP and toZIP export

Don Brutzman brutzman at nps.edu
Tue Oct 31 20:08:37 PDT 2017


X3D Java Scene Access Interface Library (X3DJSAIL) supports programmers with standards-based X3D Java interfaces and objects, all as open source.

Tonight's release of X3DJSAIL includes methods for toGZIP and toZIP export.  These are invocable via methods or command line.

	X3D Java Scene Access Interface Library (X3DJSAIL)
	http://www.web3d.org/specifications/java/X3DJSAIL.html

Example invocation and output:

System.out.println ("===========================================");
System.out.println ("Test toFileGZIP()");
savedFileName   = thisSceneName + X3DObject.FILE_EXTENSION_GZIP;
File gzipFile   = x3dModel.toFileGZIP(savedFileName);
compressionRatio = formatPrecision2.format((double)gzipFile.length()/(double)sourceFile.length() * 100.0);
System.out.println (gzipFile.getName() + "  filesize " + gzipFile.length() + " bytes, compression " + compressionRatio + "% of original");
System.out.println ("===========================================");
System.out.println ("Test toFileZip()");
String savedZipName = thisSceneName + X3DObject.FILE_EXTENSION_ZIP;
savedFileName   = thisSceneName + X3DObject.FILE_EXTENSION_X3D;
File zipFile    = x3dModel.toFileZIP(savedZipName, savedFileName);
compressionRatio = formatPrecision2.format((double)zipFile.length()/(double)sourceFile.length() * 100.0);
System.out.println (zipFile.getName() + " filesize " + zipFile.length() + " bytes, compression " + compressionRatio + "% of original");
System.out.println ("===========================================");

===========================================
Source file HelloWorldProgramOutput.x3d 19946 bytes
===========================================
Test toFileGZIP()
HelloWorldProgramOutput.gz  filesize 5069 bytes, compression 25.41% of original
===========================================
Test toFileZip()
HelloWorldProgramOutput.zip filesize 5317 bytes, compression 26.66% of original
===========================================

Javadoc:
X3DObject.toFileGZIP(resultFileName)
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3DObject.html#toFileGZIP-java.lang.String-

X3DObject.toFileZIP(zipFileName,modelName)
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3DObject.html#toFileZIP-java.lang.String-java.lang.String-

Nice development improvement:  in addition to manual shell testing, am also testing CommandLine invocation directly from within HelloWorldProgram.java which allows IDE debugging and recording/diffing of unit-test (smoke test) results.

Next up: -toEXI using OpenEXI codebase, then -fromGZIP -fromZIP -fromEXI readers. Better and better.

Hv fn wth X3D!

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list