DMelt:IO/2 Java and Python IO

From HandWiki
Jump to: navigation, search
Limitted access. First login to DataMelt if you are a full DataMelt member. Then login to HandWiki as a user.

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.