public static void int16(long value, OutputStream stream) throws IOException { int16(value, stream, null); }
public static void int16(long value, OutputStream stream) throws IOException { int16(value, stream, null); }
private void writeCoordinateComponent(OutputStream out, byte[] x) throws IOException { int offset = Bytes.numberOfLeadingZeros(x); int length = x.length - offset; Encode.int16(length, out); out.write(x, offset, length); }
private void writeCoordinateComponent(ByteBuffer buffer, byte[] x) { int offset = Bytes.numberOfLeadingZeros(x); int length = x.length - offset; Encode.int16(length, buffer); buffer.put(x, offset, length); }
private void writeCoordinateComponent(OutputStream out, ECFieldElement coord) throws IOException { byte[] x = coord.getEncoded(); int offset = Bytes.numberOfLeadingZeros(x); int length = x.length - offset; Encode.int16(length, out); out.write(x, offset, length); }
@Override public void write(ByteBuffer buffer) { buffer.put(initializationVector); Encode.int16(curveType, buffer); writeCoordinateComponent(buffer, Points.getX(R)); writeCoordinateComponent(buffer, Points.getY(R)); buffer.put(encrypted); buffer.put(mac); }
public void write(ByteBuffer buffer, boolean light) { if (!light) { Encode.int64(time, buffer); Encode.int32(stream, buffer); } Encode.int64(services, buffer); buffer.put(ipv6); Encode.int16(port, buffer); }
private void writeWithoutMAC(OutputStream out) throws IOException { out.write(initializationVector); Encode.int16(curveType, out); writeCoordinateComponent(out, Points.getX(R)); writeCoordinateComponent(out, Points.getY(R)); out.write(encrypted); }
public void write(OutputStream stream, boolean light) throws IOException { if (!light) { Encode.int64(time, stream); Encode.int32(this.stream, stream); } Encode.int64(services, stream); stream.write(ipv6); Encode.int16(port, stream); }
public void write(OutputStream out, boolean light) throws IOException { if (!light) { Encode.int64(time, out); Encode.int32(stream, out); } Encode.int64(services, out); out.write(ipv6); Encode.int16(port, out); }
private void writeWithoutMAC(OutputStream out) throws IOException { out.write(initializationVector); Encode.int16(curveType, out); writeCoordinateComponent(out, R.getXCoord()); writeCoordinateComponent(out, R.getYCoord()); out.write(encrypted); }
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); } }