Yes u can, or possibly even

DataInputStream in = new DataInputStream(new ZipInputStream(...));
long l = in.readLong();
float f = in.readFloat();


"Jenkins, Andrew B" wrote:

> Just to add to what Rajesh said, you can do the same thing for longs
> (shifting 8 bytes instead of 4, of course).  You can also create floats
> and doubles by reading the 4 (8) bytes as an int (long), and then
> calling Float.intBitsToFloat() (Double.longBitsToDouble()), provided
> the floating point numbers were encoded in IEEE 754 format.
>
> --Andy
>
> Andy Jenkins
> [EMAIL PROTECTED]
>
> > ----------
> > From:         Rajesh Gupta[SMTP:[EMAIL PROTECTED]]
> > Reply To:     Rajesh Gupta
> > Sent:         Sunday, June 20, 1999 5:20 AM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Byte conversion
> >
> > Hi,
> > If you have written the integer in Java ( using DataOutputStream), Unix or
> > any other Big endian system
> > Do something like
> > InputStream in;
> > int i = (((( in.read() << 8) | in.read())) << 16) | (( in.read() << 8) |
> > in.read());
> >
> > If you have written the int on a windows or any other small endian system
> > (Java is big-endian on all platforms) use something like
> >
> > InputStream in;
> > int i = (in.read() | (in.read() << 8)) | ((in.read() | (in.read() << 8)) <<
> > 16);
> >
> > Hope it helps.
> >
> > Rajesh
> >
> >
> > ----- Original Message -----
> > From: Vassiliadis Michalis <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, June 18, 1999 12:56 AM
> > Subject: Byte conversion
> >
> >
> > > Hi!
> > > I am trying to read a compessed file (zip format) where there are data
> > > values. Using the method int read(byte[] b, int off, int len) of the
> > > ZipInputStream class, I get the data in byte format. How can I convert
> > them
> > > to another format (i.e. Integer)?
> > > Thanks in advance.
> > >
> > > -
> > > Michalis Vassiliadis
> > > Systems Engineer
> > > ---------------------
> > > BULL S.A.
> > > 67B, Sofouli, 551 31,
> > > Thessaloniki, Greece.
> > > Tel & Fax: 0030-31-423866
> > > http://www.bull.gr
> > > http://www.bull.com
> > >
> > >
> >

Reply via email to