alternatyve in php (from java)
- by Valdas
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.