How to get first bytes value from an InputStream?
807606May 23 2007 — edited May 23 2007Hello,
I'm scanning a database for pictures and retreive them through a call to ResultSet.getBinaryStream(1) that gives me an InputStream.
I would like to scan the first 2 bytes to know if the returned stream is a JPEG picture (first 2 bytes must be 0xFF and 0xD8).
I can see them in the protected "buf" member of InputStream in the debugger but how can I access them through the code?
Is there a way to convert the InputStream into a byte array?
Regards,
Lara.