You are a guest. Restricted access. Read more.
Command disabled: revisions
SCaVis manual

Java and Python IO

Native Java IO classes

Read Java IO tutorial

Below we show a simple example of how to use Java classes using Python/Jython syntax for IO:

Code example

  Download for this example is disabled for non-members
1: from java.io import *
2: fo=FileOutputStream('data.d')
3: out=DataOutputStream(BufferedOutputStream( fo ))
4: list=[1.,2.,3.,4.,5.]
5: for a in list:
6:    out.writeFloat(a)
7: out.close()
8: fo.close()

Native Python IO

Read Python IO tutorial Below we show an example of how to write a list of numbers using the Python class “pickle” for IO:

>>> import pickle
>>> f=open('data.pic','w')
>>> pickle.dump([1,2,3,4],f)
>>> f.close()

I/O performance and benchmarks

Here we compare performance of the PFile and HFile classes for read and write mode. Benchmark results are given together with the code.

Unregistered users have a limited access to this section. You can unlock advanced pages after becoming a full member.

Third-party IO classes

click here if you want to know more

click here if you want to know more

click here if you want to know more

here are a lot of other Java-based I/O classes designed for storing and retrieving data. A complete description of how to use Java, Jython and SCaVis for scientific analysis is described in the book Scientific data analysis using Jython and Java published by Springer Verlag, London, 2010 (by S.V.Chekanov)

Sergei Chekanov 2010/03/07 17:35

man/io/java_python.txt · Last modified: 2013/05/31 16:11 (external edit)
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5