public int readByte() throws IOException { byte b = codedIS.readRawByte(); if (b < 0) { return b + 256; } else { return b; } }
/** Read a 32-bit little-endian integer from the stream. */ public int readRawLittleEndian32() throws IOException { final byte b1 = readRawByte(); final byte b2 = readRawByte(); final byte b3 = readRawByte(); final byte b4 = readRawByte(); return (((int)b1 & 0xff) ) | (((int)b2 & 0xff) << 8) | (((int)b3 & 0xff) << 16) | (((int)b4 & 0xff) << 24); }
/** Read a 64-bit little-endian integer from the stream. */ public long readRawLittleEndian64() throws IOException { final byte b1 = readRawByte(); final byte b2 = readRawByte(); final byte b3 = readRawByte(); final byte b4 = readRawByte(); final byte b5 = readRawByte(); final byte b6 = readRawByte(); final byte b7 = readRawByte(); final byte b8 = readRawByte(); return (((long)b1 & 0xff) ) | (((long)b2 & 0xff) << 8) | (((long)b3 & 0xff) << 16) | (((long)b4 & 0xff) << 24) | (((long)b5 & 0xff) << 32) | (((long)b6 & 0xff) << 40) | (((long)b7 & 0xff) << 48) | (((long)b8 & 0xff) << 56); }
byte tmp = readRawByte(); if (tmp >= 0) { return tmp; if ((tmp = readRawByte()) >= 0) { result |= tmp << 7; } else { result |= (tmp & 0x7f) << 7; if ((tmp = readRawByte()) >= 0) { result |= tmp << 14; } else { result |= (tmp & 0x7f) << 14; if ((tmp = readRawByte()) >= 0) { result |= tmp << 21; } else { result |= (tmp & 0x7f) << 21; result |= (tmp = readRawByte()) << 28; if (tmp < 0) { if (readRawByte() >= 0) { return result;
/** Read a raw Varint from the stream. */ public long readRawVarint64() throws IOException { int shift = 0; long result = 0; while (shift < 64) { final byte b = readRawByte(); result |= (long)(b & 0x7F) << shift; if ((b & 0x80) == 0) { return result; } shift += 7; } throw InvalidProtocolBufferException.malformedVarint(); }
value = in.readBool(); } else if (clazz == byte.class || clazz == Byte.class) { value = in.readRawByte(); } else if (clazz == char.class || clazz == Character.class) { value = (char) in.readSInt32();
private void skipRawVarintSlowPath() throws IOException { for (int i = 0; i < 10; i++) { if (readRawByte() >= 0) { return; } } throw InvalidProtocolBufferException.malformedVarint(); }
private void skipRawVarintSlowPath() throws IOException { for (int i = 0; i < 10; i++) { if (readRawByte() >= 0) { return; } } throw InvalidProtocolBufferException.malformedVarint(); }
/** Variant of readRawVarint64 for when uncomfortably close to the limit. */ /* Visible for testing */ long readRawVarint64SlowPath() throws IOException { long result = 0; for (int shift = 0; shift < 64; shift += 7) { final byte b = readRawByte(); result |= (long) (b & 0x7F) << shift; if ((b & 0x80) == 0) { return result; } } throw InvalidProtocolBufferException.malformedVarint(); }
private void skipRawVarintSlowPath() throws IOException { for (int i = 0; i < 10; i++) { if (readRawByte() >= 0) { return; } } throw InvalidProtocolBufferException.malformedVarint(); }
/** Variant of readRawVarint64 for when uncomfortably close to the limit. */ /* Visible for testing */ long readRawVarint64SlowPath() throws IOException { long result = 0; for (int shift = 0; shift < 64; shift += 7) { final byte b = readRawByte(); result |= (long) (b & 0x7F) << shift; if ((b & 0x80) == 0) { return result; } } throw InvalidProtocolBufferException.malformedVarint(); }
/** Variant of readRawVarint64 for when uncomfortably close to the limit. */ /* Visible for testing */ long readRawVarint64SlowPath() throws IOException { long result = 0; for (int shift = 0; shift < 64; shift += 7) { final byte b = readRawByte(); result |= (long) (b & 0x7F) << shift; if ((b & 0x80) == 0) { return result; } } throw InvalidProtocolBufferException.malformedVarint(); }
private static byte[] toBytes(MessageLength messageLength) throws IOException { long messageSize = messageLength.getLength(); CodedInputStream stream = messageLength.getRemainingStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (int i = 0; i < messageSize; i++) { outputStream.write(stream.readRawByte()); } return outputStream.toByteArray(); }
private byte[] toBytes(MessageLength messageLength) throws IOException { long messageSize = messageLength.getLength(); CodedInputStream stream = messageLength.getRemainingStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (int i = 0; i < messageSize; i++) { outputStream.write(stream.readRawByte()); } return outputStream.toByteArray(); }
private byte[] toBytes(MessageLength messageLength) throws IOException { long messageSize = messageLength.getLength(); CodedInputStream stream = messageLength.getRemainingStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (int i = 0; i < messageSize; i++) { outputStream.write(stream.readRawByte()); } return outputStream.toByteArray(); }
private static byte[] toBytes(MessageLength messageLength) throws IOException { long messageSize = messageLength.getLength(); CodedInputStream stream = messageLength.getRemainingStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (int i = 0; i < messageSize; i++) { outputStream.write(stream.readRawByte()); } return outputStream.toByteArray(); }
value = in.readBool(); } else if (clazz == byte.class || clazz == Byte.class) { value = in.readRawByte(); } else if (clazz == char.class || clazz == Character.class) { value = (char) in.readSInt32();