Skip to content

Instantly share code, notes, and snippets.

@gthank
Created September 30, 2015 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gthank/f531b724c969c26f6d8c to your computer and use it in GitHub Desktop.
Save gthank/f531b724c969c26f6d8c to your computer and use it in GitHub Desktop.
An example of some Jython for doing File IO stuff in Java and Python
from org.python.core.io import FileIO, FileUtil
path = "/tmp/hello_world.txt"
python_fio = FileIO(path, "r")
java_is = python_fio.asInputStream()
python_file = FileUtil.wrap(java_is)
workbook = jxl.Workbook.getWorkbook(java_is)
# Do stuff with your Pythonic file interface here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment