public static void int8(long value, OutputStream stream) throws IOException { int8(value, stream, null); }
public static void int8(long value, OutputStream stream) throws IOException { int8(value, stream, null); }
public static void varInt(long value, OutputStream stream, AccessCounter counter) throws IOException { if (value < 0) { // This is due to the fact that Java doesn't really support unsigned values. // Please be aware that this might be an error due to a smaller negative value being cast to long. // Normally, negative values shouldn't occur within the protocol, and I large enough longs // to being recognized as negatives aren't realistic. stream.write(0xff); inc(counter); int64(value, stream, counter); } else if (value < 0xfd) { int8(value, stream, counter); } else if (value <= 0xffffL) { stream.write(0xfd); inc(counter); int16(value, stream, counter); } else if (value <= 0xffffffffL) { stream.write(0xfe); inc(counter); int32(value, stream, counter); } else { stream.write(0xff); inc(counter); int64(value, stream, counter); } }