Message4771

Author pjenvey
Recipients JacobKessler, fwierzbicki, pjenvey, zyasoft
Date 2009-05-31.05:47:19
SpamBayes Score 0.001467911
Marked as misclassified No
Message-id <1243748872.98.0.0145748684442.issue1276@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2009-05-31 05:47:52pjenveysetmessageid: <1243748872.98.0.0145748684442.issue1276@psf.upfronthosting.co.za>
2009-05-31 05:47:52pjenveysetrecipients: + pjenvey, fwierzbicki, zyasoft, JacobKessler
2009-05-31 05:47:47pjenveylinkissue1276 messages
2009-05-31 05:47:35pjenveycreate