@Override public boolean equals(Object other) { return other instanceof Pin && pattern.equals(((Pin) other).pattern) && hashAlgorithm.equals(((Pin) other).hashAlgorithm) && hash.equals(((Pin) other).hash); }
/** * Creates a relay that reads a recorded stream from {@code file}. * * <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to * create a source and close that when they're done. Otherwise a handle to {@code file} will be * leaked. */ public static Relay read(File file) throws IOException { RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel()); // Read the header. Buffer header = new Buffer(); fileOperator.read(0, header, FILE_HEADER_SIZE); ByteString prefix = header.readByteString(PREFIX_CLEAN.size()); if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file"); long upstreamSize = header.readLong(); long metadataSize = header.readLong(); // Read the metadata. Buffer metadataBuffer = new Buffer(); fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize); ByteString metadata = metadataBuffer.readByteString(); // Return the result. return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L); }
public void readConnectionPreface(Handler handler) throws IOException { if (client) { // The client reads the initial SETTINGS frame. if (!nextFrame(true, handler)) { throw ioException("Required SETTINGS preface not received"); } } else { // The server reads the CONNECTION_PREFACE byte string. ByteString connectionPreface = source.readByteString(CONNECTION_PREFACE.size()); if (logger.isLoggable(FINE)) logger.fine(format("<< CONNECTION %s", connectionPreface.hex())); if (!CONNECTION_PREFACE.equals(connectionPreface)) { throw ioException("Expected a connection header but was %s", connectionPreface.utf8()); } } }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RepeatedPackedAndMap)) return false; RepeatedPackedAndMap o = (RepeatedPackedAndMap) other; return unknownFields().equals(o.unknownFields()) && rep_int32.equals(o.rep_int32) && pack_int32.equals(o.pack_int32) && map_int32_int32.equals(o.map_int32_int32); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RepeatedPackedAndMap)) return false; RepeatedPackedAndMap o = (RepeatedPackedAndMap) other; return unknownFields().equals(o.unknownFields()) && rep_int32.equals(o.rep_int32) && pack_int32.equals(o.pack_int32) && map_int32_int32.equals(o.map_int32_int32); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof SourceCodeInfo)) return false; SourceCodeInfo o = (SourceCodeInfo) other; return unknownFields().equals(o.unknownFields()) && location.equals(o.location); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Mappy)) return false; Mappy o = (Mappy) other; return unknownFields().equals(o.unknownFields()) && things.equals(o.things); }
@SuppressWarnings("SelfEquals") @Test public void equals() throws Exception { ByteString byteString = factory.decodeHex("000102"); assertTrue(byteString.equals(byteString)); assertTrue(byteString.equals(ByteString.decodeHex("000102"))); assertTrue(factory.decodeHex("").equals(ByteString.EMPTY)); assertTrue(factory.decodeHex("").equals(ByteString.of())); assertTrue(ByteString.EMPTY.equals(factory.decodeHex(""))); assertTrue(ByteString.of().equals(factory.decodeHex(""))); assertFalse(byteString.equals(new Object())); assertFalse(byteString.equals(ByteString.decodeHex("000201"))); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof ServiceOptions)) return false; ServiceOptions o = (ServiceOptions) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(deprecated, o.deprecated) && uninterpreted_option.equals(o.uninterpreted_option); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedCycleA)) return false; RedactedCycleA o = (RedactedCycleA) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(b, o.b); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof LetsDataResponse)) return false; LetsDataResponse o = (LetsDataResponse) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof J)) return false; J o = (J) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(k, o.k); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedCycleB)) return false; RedactedCycleB o = (RedactedCycleB) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); }
@Test public void utf8() throws Exception { ByteString byteString = factory.encodeUtf8(bronzeHorseman); assertByteArraysEquals(byteString.toByteArray(), bronzeHorseman.getBytes(Charsets.UTF_8)); assertTrue(byteString.equals(ByteString.of(bronzeHorseman.getBytes(Charsets.UTF_8)))); assertEquals(byteString.utf8(), bronzeHorseman); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof EnumReservedRange)) return false; EnumReservedRange o = (EnumReservedRange) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(start, o.start) && Internal.equals(end, o.end); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof EnumValueOptions)) return false; EnumValueOptions o = (EnumValueOptions) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(deprecated, o.deprecated) && uninterpreted_option.equals(o.uninterpreted_option) && Internal.equals(enum_value_option, o.enum_value_option) && Internal.equals(complex_enum_value_option, o.complex_enum_value_option) && Internal.equals(foreign_enum_value_option, o.foreign_enum_value_option); }
@Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Redacted)) return false; Redacted o = (Redacted) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a) && Internal.equals(b, o.b) && Internal.equals(c, o.c) && Internal.equals(extension, o.extension); }