org.openlr.binary.reader.StatusReader Maven / Gradle / Ivy
The newest version!
package org.openlr.binary.reader;
import org.openlr.binary.format.Status;
import java.io.ByteArrayInputStream;
import java.io.IOException;
class StatusReader {
Status read(ByteArrayInputStream inputStream) throws IOException {
byte[] bytes = inputStream.readNBytes(1);
byte b = bytes[0];
byte version = (byte) (b & 0x07);
boolean attributeFlag = ((b >> 3) & 0x01) == 1;
byte areaFlag = (byte) (((b >> 5) & 0x02) + ((b >> 4) & 0x01));
boolean pointFlag = ((b >> 5) & 0x01) == 1;
return new Status(version, attributeFlag, areaFlag, pointFlag);
}
}