public void testNewDataInput_readByte() { ByteArrayDataInput in = ByteStreams.newDataInput(bytes); for (int i = 0; i < bytes.length; i++) { assertEquals(bytes[i], in.readByte()); } try { in.readByte(); fail("expected exception"); } catch (IllegalStateException ex) { assertThat(ex).hasCauseThat().isInstanceOf(EOFException.class); } }
String metric = readString(in); String type = getType(metric, aggs, i); byte metricNullability = in.readByte(); if (metricNullability == NullHandling.IS_NULL_BYTE) {
@Override public byte readByte() { byte result = in.readByte(); available--; return result; }
/** * Decodes the given byte array to a {@link SettingMap}. * * <p>Operates on the reverse of {@link SettingMap#encode()}.</p> * * @param buf the byte array * @return the decoded map */ public SettingMap<S, V> decode(byte[] buf) { if (buf.length == 0) { return newMap(); } ByteArrayDataInput in = ByteStreams.newDataInput(buf); int n = Byte.toUnsignedInt(in.readByte()); byte[] states = Arrays.copyOf(this.defaultStates, this.defaultStates.length); for (int i = 0; i < n; i++) { int settingOrdinal = Byte.toUnsignedInt(in.readByte()); byte stateByte = in.readByte(); states[settingOrdinal] = stateByte; } return new SettingMap<>(this, states); }
String metric = readString(in); String type = getType(metric, aggs, i); byte metricNullability = in.readByte(); if (metricNullability == NullHandling.IS_NULL_BYTE) {
public void testNewDataInput_readByte() { ByteArrayDataInput in = ByteStreams.newDataInput(bytes); for (int i = 0; i < bytes.length; i++) { assertEquals(bytes[i], in.readByte()); } try { in.readByte(); fail("expected exception"); } catch (IllegalStateException ex) { assertThat(ex.getCause()).isInstanceOf(EOFException.class); } }
byte result = in.readByte(); available--; return result;