DMelt:IO/2 Java and Python IO

From jWork.ORG
Jump to: navigation, search
Limitted access. Reguest membership or login to this link first if you are already a member

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:

from import *
out=DataOutputStream(BufferedOutputStream( fo ))
for a in list:

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.

More information on this topic is in DMelt books