alternatyve in php (from java)
Posted
by Valdas
on Stack Overflow
See other posts from Stack Overflow
or by Valdas
Published on 2010-04-11T20:33:02Z
Indexed on
2010/04/11
20:43 UTC
Read the original article
Hit count: 259
I have some problem have class in java. But now need have in php. it's possible rewrite? Code:
public class RealityStream {
public RealityStream(byte abyte0[]) {
m_dstream = null;
m_dstream = new DataInputStream(new ByteArrayInputStream(abyte0));
}
public int available()
throws IOException {
return m_dstream.available();
}
public float readFloat()
throws IOException {
byte byte0 = m_dstream.readByte();
byte byte1 = m_dstream.readByte();
byte byte2 = m_dstream.readByte();
byte byte3 = m_dstream.readByte();
int i = (byte3 & 0xff) << 24 | (byte2 & 0xff) << 16
| (byte1 & 0xff) << 8 | byte0 & 0xff;
return Float.intBitsToFloat(i);
}
public int readInt()
throws IOException {
byte byte0 = m_dstream.readByte();
byte byte1 = m_dstream.readByte();
byte byte2 = m_dstream.readByte();
byte byte3 = m_dstream.readByte();
return (byte3 & 0xff) << 24 | (byte2 & 0xff) << 16
| (byte1 & 0xff) << 8 | byte0 & 0xff;
}
public int readShort()
throws IOException {
byte byte0 = m_dstream.readByte();
byte byte1 = m_dstream.readByte();
return byte1 << 8 | byte0 & 0xff;
}
public int readUnsignedChar()
throws IOException {
return m_dstream.readUnsignedByte();
}
private DataInputStream m_dstream;
}
very need. very thaks.
© Stack Overflow or respective owner