public static void int32(long value, OutputStream stream) throws IOException { int32(value, stream, null); }
public static void int32(long value, OutputStream stream) throws IOException { int32(value, stream, null); }
@Override public void write(OutputStream out) throws IOException { Encode.int32(behaviorBitfield, out); out.write(publicSigningKey, 1, 64); out.write(publicEncryptionKey, 1, 64); }
@Override public void write(ByteBuffer buffer) { Encode.int32(behaviorBitfield, buffer); buffer.put(publicSigningKey, 1, 64); buffer.put(publicEncryptionKey, 1, 64); }
@Override public void write(OutputStream os) throws IOException { Encode.int32(behaviorBitfield, os); os.write(publicSigningKey, 1, 64); os.write(publicEncryptionKey, 1, 64); }
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(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); }
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); }
@Override public void write(OutputStream out) throws IOException { // magic Encode.int32(MAGIC, out); // ASCII string identifying the packet content, NULL padded (non-NULL padding results in packet rejected) String command = payload.getCommand().name().toLowerCase(); out.write(command.getBytes("ASCII")); for (int i = command.length(); i < 12; i++) { out.write('\0'); } byte[] payloadBytes = Encode.bytes(payload); // Length of payload in number of bytes. Because of other restrictions, there is no reason why this length would // ever be larger than 1600003 bytes. Some clients include a sanity-check to avoid processing messages which are // larger than this. Encode.int32(payloadBytes.length, out); // checksum try { out.write(getChecksum(payloadBytes)); } catch (GeneralSecurityException e) { throw new ApplicationException(e); } // message payload out.write(payloadBytes); }
private void writeHeaderWithoutNonce(OutputStream out) throws IOException { Encode.int64(expiresTime, out); Encode.int32(objectType, out); Encode.varInt(version, out); Encode.varInt(stream, out); }
private void writeHeaderWithoutNonce(OutputStream out) throws IOException { Encode.int64(expiresTime, out); Encode.int32(objectType, out); Encode.varInt(version, out); Encode.varInt(stream, out); }
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); } }
@Override public void write(OutputStream stream) throws IOException { Encode.int32(version, stream); Encode.int64(services, stream); Encode.int64(timestamp, stream); addrRecv.write(stream, true); addrFrom.write(stream, true); Encode.int64(nonce, stream); Encode.varString(userAgent, stream); Encode.varIntList(streams, stream); }
@Override public void write(ByteBuffer buffer) { Encode.int32(version, buffer); Encode.int64(services, buffer); Encode.int64(timestamp, buffer); addrRecv.write(buffer, true); addrFrom.write(buffer, true); Encode.int64(nonce, buffer); Encode.varString(userAgent, buffer); Encode.varIntList(streams, buffer); }
@Override public void write(OutputStream stream) throws IOException { Encode.int32(version, stream); Encode.int64(services, stream); Encode.int64(timestamp, stream); addrRecv.write(stream, true); addrFrom.write(stream, true); Encode.int64(nonce, stream); Encode.varString(userAgent, stream); Encode.varIntList(streams, stream); }
public void write(OutputStream out, boolean includeSignature) throws IOException { Encode.varInt(from.getVersion(), out); Encode.varInt(from.getStream(), out); Encode.int32(from.getPubkey().getBehaviorBitfield(), out); out.write(from.getPubkey().getSigningKey(), 1, 64); out.write(from.getPubkey().getEncryptionKey(), 1, 64); if (from.getVersion() >= 3) { Encode.varInt(from.getPubkey().getNonceTrialsPerByte(), out); Encode.varInt(from.getPubkey().getExtraBytes(), out); } if (type == Type.MSG) { out.write(to.getRipe()); } Encode.varInt(encoding, out); Encode.varInt(message.length, out); out.write(message); if (type == Type.MSG) { Encode.varInt(ack.length, out); out.write(ack); } if (includeSignature) { if (signature == null) { Encode.varInt(0, out); } else { Encode.varInt(signature.length, out); out.write(signature); } } }
public void write(OutputStream out, boolean includeSignature) throws IOException { Encode.varInt(from.getVersion(), out); Encode.varInt(from.getStream(), out); Encode.int32(from.getPubkey().getBehaviorBitfield(), out); out.write(from.getPubkey().getSigningKey(), 1, 64); out.write(from.getPubkey().getEncryptionKey(), 1, 64);
public void write(ByteBuffer buffer, boolean includeSignature) { Encode.varInt(from.getVersion(), buffer); Encode.varInt(from.getStream(), buffer); Encode.int32(from.getPubkey().getBehaviorBitfield(), buffer); buffer.put(from.getPubkey().getSigningKey(), 1, 64); buffer.put(from.getPubkey().getEncryptionKey(), 1, 64);