Reading Java byte[] data stream over standard input

John Machin sjmachin at lexicon.net
Mon May 19 09:21:06 EDT 2008


sapsi wrote:
> I should also mention that for some reason there are several binay
> values popping in between for some reason. This behavior (for the
> inputr stream) is not expected
> 
> 
>> Now, the incoming data is binary(though mine is actually merely ascii
>> text) but the output is not what is expected. I expect for e.g
>>
>> all/86000/114.310.151.209.60370-121.110.5.176.113\n62485.9718
>> 118.010.241.12 60370 128.210.5.176
>>
>> However i get a 1 before all and a 4 just after \n and before the 6.
>>
>> My question is : how do i read binary data(Java's byte stream) from
>> stdin?
>> Or is this actually what i'm getting?
>>

Consider changing "print x" to "print repr(x)" ... this would mean that 
you have a better chance of understanding what the extra or unexpected 
popping-in bytes are.



More information about the Python-list mailing list