protected byte[] readBytes(int length) throws ProtocolException { if (length > MAX_SIZE) { throw new ProtocolException("Claimed value length too large: " + length); } try { byte[] b = new byte[length]; System.arraycopy(payload, cursor, b, 0, length); cursor += length; return b; } catch (IndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected byte[] readBytes(int length) throws ProtocolException { if (length > MAX_SIZE) { throw new ProtocolException("Claimed value length too large: " + length); } try { byte[] b = new byte[length]; System.arraycopy(payload, cursor, b, 0, length); cursor += length; return b; } catch (IndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected byte[] readBytes(int length) throws ProtocolException { if (length > MAX_SIZE) { throw new ProtocolException("Claimed value length too large: " + length); } try { byte[] b = new byte[length]; System.arraycopy(payload, cursor, b, 0, length); cursor += length; return b; } catch (IndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected byte[] readBytes(int length) throws ProtocolException { if (length > MAX_SIZE) { throw new ProtocolException("Claimed value length too large: " + length); } try { byte[] b = new byte[length]; System.arraycopy(payload, cursor, b, 0, length); cursor += length; return b; } catch (IndexOutOfBoundsException e) { throw new ProtocolException(e); } }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readVarInt(int offset) throws ProtocolException { try { VarInt varint = new VarInt(payload, cursor + offset); cursor += offset + varint.getOriginalSizeInBytes(); return varint.value; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
@Override protected void parse() throws ProtocolException { data = readByteArray(); if (data.length > MAX_FILTER_SIZE) throw new ProtocolException ("Bloom filter out of size range."); hashFuncs = readUint32(); if (hashFuncs > MAX_HASH_FUNCS) throw new ProtocolException("Bloom filter hash function count out of range"); nTweak = readUint32(); nFlags = readBytes(1)[0]; length = cursor - offset; }
@Override protected void parse() throws ProtocolException { data = readByteArray(); if (data.length > MAX_FILTER_SIZE) throw new ProtocolException ("Bloom filter out of size range."); hashFuncs = readUint32(); if (hashFuncs > MAX_HASH_FUNCS) throw new ProtocolException("Bloom filter hash function count out of range"); nTweak = readUint32(); nFlags = readBytes(1)[0]; length = cursor - offset; }
protected long readVarInt(int offset) throws ProtocolException { try { VarInt varint = new VarInt(payload, cursor + offset); cursor += offset + varint.getOriginalSizeInBytes(); return varint.value; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }