public static long varInt(InputStream stream) throws IOException { return varInt(stream, null); }
public static long varInt(InputStream in) throws IOException { return varInt(in, null); }
public static PrivateKey read(InputStream is) throws IOException { int version = (int) Decode.varInt(is); long stream = Decode.varInt(is); int len = (int) Decode.varInt(is); Pubkey pubkey = Factory.readPubkey(version, stream, is, len, false); len = (int) Decode.varInt(is); byte[] signingKey = Decode.bytes(is, len); len = (int) Decode.varInt(is); byte[] encryptionKey = Decode.bytes(is, len); return new PrivateKey(signingKey, encryptionKey, pubkey); }
public static PrivateKey read(InputStream is) throws IOException { int version = (int) Decode.varInt(is); long stream = Decode.varInt(is); int len = (int) Decode.varInt(is); Pubkey pubkey = Factory.readPubkey(version, stream, is, len, false); len = (int) Decode.varInt(is); byte[] signingKey = Decode.bytes(is, len); len = (int) Decode.varInt(is); byte[] encryptionKey = Decode.bytes(is, len); return new PrivateKey(signingKey, encryptionKey, pubkey); }
public static String varString(InputStream in, AccessCounter counter) throws IOException { int length = (int) varInt(in, counter); // FIXME: technically, it says the length in characters, but I think this one might be correct // otherwise it will get complicated, as we'll need to read UTF-8 char by char... return new String(bytes(in, length, counter), "utf-8"); }
public static String varString(InputStream stream) throws IOException { int length = (int) varInt(stream); // FIXME: technically, it says the length in characters, but I think this one might be correct // otherwise it will get complicated, as we'll need to read UTF-8 char by char... return new String(bytes(stream, length), "utf-8"); } }
public static byte[] varBytes(InputStream in, AccessCounter counter) throws IOException { int length = (int) varInt(in, counter); return bytes(in, length, counter); }
public static byte[] varBytes(InputStream stream) throws IOException { int length = (int) varInt(stream, null); return bytes(stream, length, null); }
public static byte[] varBytes(InputStream stream, AccessCounter counter) throws IOException { int length = (int) varInt(stream, counter); return bytes(stream, length, counter); }
public static Plaintext.Builder readWithoutSignature(Type type, InputStream in) throws IOException { long version = Decode.varInt(in); return new Builder(type) .addressVersion(version) .stream(Decode.varInt(in)) .behaviorBitfield(Decode.int32(in)) .publicSigningKey(Decode.bytes(in, 64)) .publicEncryptionKey(Decode.bytes(in, 64)) .nonceTrialsPerByte(version >= 3 ? Decode.varInt(in) : 0) .extraBytes(version >= 3 ? Decode.varInt(in) : 0) .destinationRipe(type == Type.MSG ? Decode.bytes(in, 20) : null) .encoding(Decode.varInt(in)) .message(Decode.varBytes(in)) .ackMessage(type == Type.MSG ? Decode.varBytes(in) : null); }
private static GetData parseGetData(InputStream stream) throws IOException { long count = Decode.varInt(stream); GetData.Builder builder = new GetData.Builder(); for (int i = 0; i < count; i++) { builder.addInventoryVector(parseInventoryVector(stream)); } return builder.build(); }
private static Inv parseInv(InputStream stream) throws IOException { long count = Decode.varInt(stream); Inv.Builder builder = new Inv.Builder(); for (int i = 0; i < count; i++) { builder.addInventoryVector(parseInventoryVector(stream)); } return builder.build(); }
private static Addr parseAddr(InputStream stream) throws IOException { long count = Decode.varInt(stream); Addr.Builder builder = new Addr.Builder(); for (int i = 0; i < count; i++) { builder.addAddress(parseAddress(stream, false)); } return builder.build(); }
private static GetData parseGetData(InputStream stream) throws IOException { long count = Decode.varInt(stream); GetData.Builder builder = new GetData.Builder(); for (int i = 0; i < count; i++) { builder.addInventoryVector(parseInventoryVector(stream)); } return builder.build(); }
private static Inv parseInv(InputStream stream) throws IOException { long count = Decode.varInt(stream); Inv.Builder builder = new Inv.Builder(); for (int i = 0; i < count; i++) { builder.addInventoryVector(parseInventoryVector(stream)); } return builder.build(); }
private static Addr parseAddr(InputStream stream) throws IOException { long count = Decode.varInt(stream); Addr.Builder builder = new Addr.Builder(); for (int i = 0; i < count; i++) { builder.addAddress(parseAddress(stream, false)); } return builder.build(); }
public static V3Pubkey read(InputStream is, long stream) throws IOException { return new V3Pubkey.Builder() .stream(stream) .behaviorBitfield(Decode.int32(is)) .publicSigningKey(Decode.bytes(is, 64)) .publicEncryptionKey(Decode.bytes(is, 64)) .nonceTrialsPerByte(Decode.varInt(is)) .extraBytes(Decode.varInt(is)) .signature(Decode.varBytes(is)) .build(); }
public static V3Pubkey read(InputStream is, long stream) throws IOException { return new V3Pubkey.Builder() .stream(stream) .behaviorBitfield(Decode.int32(is)) .publicSigningKey(Decode.bytes(is, 64)) .publicEncryptionKey(Decode.bytes(is, 64)) .nonceTrialsPerByte(Decode.varInt(is)) .extraBytes(Decode.varInt(is)) .signature(Decode.varBytes(is)) .build(); }