okio.ByteString.equals()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中okio.ByteString.equals()方法的一些代码示例,展示了ByteString.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.equals()方法的具体详情如下:
包路径:okio.ByteString
类名称:ByteString
方法名:equals

ByteString.equals介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

@Override public boolean equals(Object other) {
 if (other instanceof Header) {
  Header that = (Header) other;
  return this.name.equals(that.name)
    && this.value.equals(that.value);
 }
 return false;
}

代码示例来源:origin: square/okhttp

@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);
}

代码示例来源:origin: square/okhttp

/**
 * 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);
}

代码示例来源:origin: square/okhttp

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());
  }
 }
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/okio

@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")));
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/okio

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

代码示例来源:origin: square/wire

@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);
}

相关文章