public static int uint16(InputStream in) throws IOException { return uint16(in, null); }
public static int uint16(InputStream stream) throws IOException { return uint16(stream, null); }
public static byte[] shortVarBytes(InputStream in, AccessCounter counter) throws IOException { int length = uint16(in, counter); return bytes(in, length, counter); }
public static byte[] shortVarBytes(InputStream stream, AccessCounter counter) throws IOException { int length = uint16(stream, counter); return bytes(stream, length, counter); }
public static long varInt(InputStream stream, AccessCounter counter) throws IOException { int first = stream.read(); inc(counter); switch (first) { case 0xfd: return uint16(stream, counter); case 0xfe: return uint32(stream, counter); case 0xff: return int64(stream, counter); default: return first; } }
public static long varInt(InputStream in, AccessCounter counter) throws IOException { int first = in.read(); inc(counter); switch (first) { case 0xfd: return uint16(in, counter); case 0xfe: return uint32(in, counter); case 0xff: return int64(in, counter); default: return first; } }
private static NetworkAddress parseAddress(InputStream stream, boolean light) throws IOException { long time; long streamNumber; if (!light) { time = Decode.int64(stream); streamNumber = Decode.uint32(stream); // This isn't consistent, not sure if this is correct } else { time = 0; streamNumber = 0; } long services = Decode.int64(stream); byte[] ipv6 = Decode.bytes(stream, 16); int port = Decode.uint16(stream); return new NetworkAddress.Builder().time(time).stream(streamNumber).services(services).ipv6(ipv6).port(port).build(); }
public static CryptoBox read(InputStream stream, int length) throws IOException { AccessCounter counter = new AccessCounter(); return new Builder() .IV(Decode.bytes(stream, 16, counter)) .curveType(Decode.uint16(stream, counter)) .X(Decode.shortVarBytes(stream, counter)) .Y(Decode.shortVarBytes(stream, counter)) .encrypted(Decode.bytes(stream, length - counter.length() - 32)) .MAC(Decode.bytes(stream, 32)) .build(); }
public static CryptoBox read(InputStream stream, int length) throws IOException { AccessCounter counter = new AccessCounter(); return new Builder() .IV(Decode.bytes(stream, 16, counter)) .curveType(Decode.uint16(stream, counter)) .X(Decode.shortVarBytes(stream, counter)) .Y(Decode.shortVarBytes(stream, counter)) .encrypted(Decode.bytes(stream, length - counter.length() - 32)) .MAC(Decode.bytes(stream, 32)) .build(); }
private static NetworkAddress parseAddress(InputStream stream, boolean light) throws IOException { long time; long streamNumber; if (!light) { time = Decode.int64(stream); streamNumber = Decode.uint32(stream); // This isn't consistent, not sure if this is correct } else { time = 0; streamNumber = 0; } long services = Decode.int64(stream); byte[] ipv6 = Decode.bytes(stream, 16); int port = Decode.uint16(stream); return new NetworkAddress.Builder() .time(time) .stream(streamNumber) .services(services) .ipv6(ipv6) .port(port) .build(); }