@Test public void testEncodeZigZag32() { Assert.assertEquals(0x00000000, ProtobufOutput.encodeZigZag32(0x00000000)); Assert.assertEquals(0x02020202, ProtobufOutput.encodeZigZag32(0x01010101)); Assert.assertEquals(0x000001FF, ProtobufOutput.encodeZigZag32(0xFFFFFF00)); Assert.assertEquals(0x00000001, ProtobufOutput.encodeZigZag32(0xFFFFFFFF)); }
public static int encodeZigZag32(final int n) { return (n << 1) ^ (n >> 31); }
ProtobufOutput extends WriteSession implements Output { public static int encodeZigZag32(final int n) { return (n << 1) ^ (n >> 31); } }
ProtobufOutput extends WriteSession implements Output { public static int encodeZigZag32(final int n) { return (n << 1) ^ (n >> 31); } ProtobufOutput(LinkedBuffer buffer);  ProtobufOutput(LinkedBuffer buffer, int nextBufferSize); }
ProtobufOutput extends WriteSession implements Output { public static int encodeZigZag32(final int n) { return (n << 1) ^ (n >> 31); } ProtobufOutput(LinkedBuffer buffer);  ProtobufOutput(LinkedBuffer buffer, int nextBufferSize); @Override ProtobufOutput clear(); @Override void writeInt32(int fieldNumber, int value, boolean repeated); @Override void writeUInt32(int fieldNumber, int value, boolean repeated); @Override void writeSInt32(int fieldNumber, int value, boolean repeated); @Override void writeFixed32(int fieldNumber, int value, boolean repeated); @Override void writeSFixed32(int fieldNumber, int value, boolean repeated); @Override void writeInt64(int fieldNumber, long value, boolean repeated); @Override void writeUInt64(int fieldNumber, long value, boolean repeated); @Override void writeSInt64(int fieldNumber, long value, boolean repeated); @Override void writeFixed64(int fieldNumber, long value, boolean repeated); @Override void writeSFixed64(int fieldNumber, long value, boolean repeated); @Override void writeFloat(int fieldNumber, float value, boolean repeated); @Override void writeDouble(int fieldNumber, double value, boolean repeated); @Override void writeBool(int fieldNumber, boolean value, boolean repeated); @Override void writeEnum(int fieldNumber, int number, boolean repeated); @Override void writeString(int fieldNumber, CharSequence value, boolean repeated); @Override void writeBytes(int fieldNumber, ByteString value, boolean repeated); @Override void writeByteArray(int fieldNumber, byte[] bytes, boolean repeated); @Override void writeByteRange(boolean utf8String, int fieldNumber, byte[] value,
            int offset, int length, boolean repeated); @Override void writeObject(final int fieldNumber, final T value, final Schema<T> schema,
            final boolean repeated); static LinkedBuffer writeRawVarInt32(int value, final WriteSession session,
            LinkedBuffer lb); static LinkedBuffer writeTagAndLinkedBuffer(int tag,
            final LinkedBuffer buffer, final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndByteArray(int tag, final byte[] value,
            int offset, int valueLen,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawVarInt32(int tag, int value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawVarInt64(int tag, long value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawLittleEndian32(int tag, int value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawLittleEndian64(int tag, long value,
            final WriteSession session, LinkedBuffer lb); static void writeRawVarInt32(int value, final byte[] buf, int offset); static void writeRawVarInt32Bytes(OutputStream out, int value); static void writeRawVarInt32Bytes(DataOutput out, int value); static byte[] getTagAndRawVarInt32Bytes(int tag, int value); static byte[] getTagAndRawVarInt64Bytes(int tag, long value); static byte[] getTagAndRawLittleEndian32Bytes(int tag, int value); static byte[] getTagAndRawLittleEndian64Bytes(int tag, long value); static int writeRawLittleEndian32(int value, byte[] buffer, int offset); static int writeRawLittleEndian64(long value, byte[] buffer, int offset); static byte[] getRawVarInt32Bytes(int value); static int computeRawVarint32Size(final int value); static int computeRawVarint64Size(final long value); static int encodeZigZag32(final int n); static long encodeZigZag64(final long n); @Override void writeBytes(int fieldNumber, ByteBuffer value, boolean repeated); }
ProtobufOutput extends WriteSession implements Output { public static int encodeZigZag32(final int n) { return (n << 1) ^ (n >> 31); } ProtobufOutput(LinkedBuffer buffer);  ProtobufOutput(LinkedBuffer buffer, int nextBufferSize); @Override ProtobufOutput clear(); @Override void writeInt32(int fieldNumber, int value, boolean repeated); @Override void writeUInt32(int fieldNumber, int value, boolean repeated); @Override void writeSInt32(int fieldNumber, int value, boolean repeated); @Override void writeFixed32(int fieldNumber, int value, boolean repeated); @Override void writeSFixed32(int fieldNumber, int value, boolean repeated); @Override void writeInt64(int fieldNumber, long value, boolean repeated); @Override void writeUInt64(int fieldNumber, long value, boolean repeated); @Override void writeSInt64(int fieldNumber, long value, boolean repeated); @Override void writeFixed64(int fieldNumber, long value, boolean repeated); @Override void writeSFixed64(int fieldNumber, long value, boolean repeated); @Override void writeFloat(int fieldNumber, float value, boolean repeated); @Override void writeDouble(int fieldNumber, double value, boolean repeated); @Override void writeBool(int fieldNumber, boolean value, boolean repeated); @Override void writeEnum(int fieldNumber, int number, boolean repeated); @Override void writeString(int fieldNumber, CharSequence value, boolean repeated); @Override void writeBytes(int fieldNumber, ByteString value, boolean repeated); @Override void writeByteArray(int fieldNumber, byte[] bytes, boolean repeated); @Override void writeByteRange(boolean utf8String, int fieldNumber, byte[] value,
            int offset, int length, boolean repeated); @Override void writeObject(final int fieldNumber, final T value, final Schema<T> schema,
            final boolean repeated); static LinkedBuffer writeRawVarInt32(int value, final WriteSession session,
            LinkedBuffer lb); static LinkedBuffer writeTagAndLinkedBuffer(int tag,
            final LinkedBuffer buffer, final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndByteArray(int tag, final byte[] value,
            int offset, int valueLen,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawVarInt32(int tag, int value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawVarInt64(int tag, long value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawLittleEndian32(int tag, int value,
            final WriteSession session, LinkedBuffer lb); static LinkedBuffer writeTagAndRawLittleEndian64(int tag, long value,
            final WriteSession session, LinkedBuffer lb); static void writeRawVarInt32(int value, final byte[] buf, int offset); static void writeRawVarInt32Bytes(OutputStream out, int value); static void writeRawVarInt32Bytes(DataOutput out, int value); static byte[] getTagAndRawVarInt32Bytes(int tag, int value); static byte[] getTagAndRawVarInt64Bytes(int tag, long value); static byte[] getTagAndRawLittleEndian32Bytes(int tag, int value); static byte[] getTagAndRawLittleEndian64Bytes(int tag, long value); static int writeRawLittleEndian32(int value, byte[] buffer, int offset); static int writeRawLittleEndian64(long value, byte[] buffer, int offset); static byte[] getRawVarInt32Bytes(int value); static int computeRawVarint32Size(final int value); static int computeRawVarint64Size(final long value); static int encodeZigZag32(final int n); static long encodeZigZag64(final long n); @Override void writeBytes(int fieldNumber, ByteBuffer value, boolean repeated); static final int LITTLE_ENDIAN_32_SIZE; }