Message4771
It sounds like you're just not using an InputStream correctly. There's
only read(), read(byte[]) and read(byte[], int, int). You can create a
byte[] with the array module to use the latter 2, e.g.:
Jython 2.5rc3+ (trunk:6432:6433M, May 30 2009, 22:11:31)
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> fp = open('/tmp/foo', 'w+')
>>> fp.write('Hello World')
>>> fp.seek(0)
>>> from java.io import FileInputStream
>>> import array
>>> fis = FileInputStream('/tmp/foo')
>>> chr(fis.read())
'H'
>>> buf = array.array('b', [0] * 10)
>>> fis.read(buf)
10
>>> buf
array('b', [101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
>>> buf.tostring()
'ello World' |
|
Date |
User |
Action |
Args |
2009-05-31 05:47:52 | pjenvey | set | messageid: <1243748872.98.0.0145748684442.issue1276@psf.upfronthosting.co.za> |
2009-05-31 05:47:52 | pjenvey | set | recipients:
+ pjenvey, fwierzbicki, zyasoft, JacobKessler |
2009-05-31 05:47:47 | pjenvey | link | issue1276 messages |
2009-05-31 05:47:35 | pjenvey | create | |
|