posted 19 years ago
Hi Guys,
I'm just wondering how to read data types such as float, double, short and long from an InputStream that is reading a file. I've been using RandonAccessFile to do this so far, given that it has methods such as readFloat() which InputStream doesn't have...now I need to use InputStream to read data in a similar way because I'm reading from inside a zip file. The read() method of InputStream returns a byte or array of bytes, but how do I convert these into the aforementioned types? For example if I want to read a short (2 bytes), I presume I need to grab 2 bytes from the input stream, but than I'm stuck...how is that converted into a short value??? Any help greatly appreciated.
SCJP 1.4, www.gsi3d.org.uk