if (StringUtils.isEqual(name, MetaDataKeys.header.name())) { wireStore = valueIn.typedMarshallable(); } else {
@Test public void testReadingSecondDocumentNotExistIncludingMeta() { try (final ChronicleQueue chronicle = builder(getTmpDir(), this.wireType) .build()) { final ExcerptAppender appender = chronicle.acquireAppender(); try (DocumentContext dc = appender.writingDocument()) { dc.wire().write(() -> "FirstName").text("Quartilla"); } final ExcerptTailer tailer = chronicle.createTailer(); StringBuilder event = new StringBuilder(); while (true) { try (DocumentContext dc = tailer.readingDocument(true)) { ValueIn in = dc.wire().read(event); if (!StringUtils.isEqual(event, "FirstName")) continue; in.text("Quartilla", Assert::assertEquals); break; } } try (DocumentContext dc = tailer.readingDocument()) { assertFalse(dc.isPresent()); } } }
default boolean isEqual(String s) { return StringUtils.isEqual(this, s); }
public static boolean equals(Object o1, Object o2) { if (o1 == o2) return true; if (o1 instanceof CharSequence && o2 instanceof CharSequence) return StringUtils.isEqual((CharSequence) o1, (CharSequence) o2); return o1 != null && o1.equals(o2); }
@Nullable public String intern(@Nullable CharSequence cs) { if (cs == null) return null; if (cs.length() > interner.length) return cs.toString(); int hash = Maths.hash32(cs); int h = hash & mask; String s = interner[h]; if (StringUtils.isEqual(cs, s)) return s; int h2 = (hash >> shift) & mask; String s2 = interner[h2]; if (StringUtils.isEqual(cs, s2)) return s2; @NotNull String s3 = cs.toString(); interner[s == null || (s2 != null && toggle()) ? h : h2] = s3; return s3; }
public E intern(@NotNull CharSequence cs) { int h = Maths.hash32(cs) & mask; E e = interner[h]; if (e != null && StringUtils.isEqual(e.name(), cs)) return e; @NotNull String s2 = cs.toString(); E value = enumCache.valueOf(s2); interner[h] = value; return interner[h]; } }
public E intern(@NotNull CharSequence cs) { int h = Maths.hash32(cs) & mask; E e = interner[h]; if (e != null && StringUtils.isEqual(e.name(), cs)) return e; @NotNull String s2 = cs.toString(); E value = enumCache.valueOf(s2); interner[h] = value; return interner[h]; } }
@ForceInline public static boolean isEqual(@Nullable CharSequence s, @Nullable CharSequence cs) { if (s instanceof StringBuilder) { return isEqual((StringBuilder) s, cs); } if (s == cs) return true; if (s == null) return false; if (cs == null) return false; int sLength = s.length(); int csLength = cs.length(); if (sLength != csLength) return false; for (int i = 0; i < csLength; i++) if (s.charAt(i) != cs.charAt(i)) return false; return true; }
@ForceInline public static boolean isEqual(@Nullable CharSequence s, @Nullable CharSequence cs) { if (s instanceof StringBuilder) { return isEqual((StringBuilder) s, cs); } if (s == cs) return true; if (s == null) return false; if (cs == null) return false; int sLength = s.length(); int csLength = cs.length(); if (sLength != csLength) return false; for (int i = 0; i < csLength; i++) if (s.charAt(i) != cs.charAt(i)) return false; return true; }
@Nullable public String intern(@Nullable CharSequence cs) { if (cs == null) return null; if (cs.length() > interner.length) return cs.toString(); int hash = Maths.hash32(cs); int h = hash & mask; String s = interner[h]; if (StringUtils.isEqual(cs, s)) return s; int h2 = (hash >> shift) & mask; String s2 = interner[h2]; if (StringUtils.isEqual(cs, s2)) return s2; @NotNull String s3 = cs.toString(); interner[s == null || (s2 != null && toggle()) ? h : h2] = s3; return s3; }
@Nullable public E intern(@Nullable CharSequence cs) { if (cs == null) return null; int hash = Maths.hash32(cs); int h = hash & mask; ParsedData<E> s = interner[h]; if (s != null && StringUtils.isEqual(s.string, cs)) return s.e; int h2 = (hash >> shift) & mask; ParsedData<E> s2 = interner[h2]; if (s2 != null && StringUtils.isEqual(s2.string, cs)) return s2.e; @NotNull String string = cs.toString(); @NotNull ParsedData<E> s3 = new ParsedData<>(string, eFunction.apply(string)); interner[s == null || (s2 != null && toggle()) ? h : h2] = s3; return s3.e; }
@Nullable public E intern(@Nullable CharSequence cs) { if (cs == null) return null; int hash = Maths.hash32(cs); int h = hash & mask; ParsedData<E> s = interner[h]; if (s != null && StringUtils.isEqual(s.string, cs)) return s.e; int h2 = (hash >> shift) & mask; ParsedData<E> s2 = interner[h2]; if (s2 != null && StringUtils.isEqual(s2.string, cs)) return s2.e; @NotNull String string = cs.toString(); @NotNull ParsedData<E> s3 = new ParsedData<>(string, eFunction.apply(string)); interner[s == null || (s2 != null && toggle()) ? h : h2] = s3; return s3.e; }
case 'b': case '!': if (StringUtils.isEqual("binary", cs) || StringUtils.isEqual("!binary", cs)) { Compressions.Binary.uncompress(from, to); return; if (StringUtils.isEqual("lzw", cs)) { Compressions.LZW.uncompress(from, to); return; if (StringUtils.isEqual("snappy", cs)) { Compressions.Snappy.uncompress(from, to); return; if (StringUtils.isEqual("gzip", cs)) { Compressions.GZIP.uncompress(from, to); return;
static <T> void compress(@NotNull CharSequence cs, @NotNull Bytes uncompressed, @NotNull Bytes compressed) { switch (cs.charAt(0)) { case 'l': if (StringUtils.isEqual("lzw", cs)) { Compressions.LZW.compress(uncompressed, compressed); return; } break; case 's': if (StringUtils.isEqual("snappy", cs)) { Compressions.Snappy.compress(uncompressed, compressed); return; } break; case 'g': if (StringUtils.isEqual("gzip", cs)) { Compressions.GZIP.compress(uncompressed, compressed); return; } break; default: break; } Compressions.Binary.compress(uncompressed, compressed); }
public RequestContext intern(@NotNull CharSequence cs) { int h = Maths.hash32(cs) & mask; StringToRequestContext s = interner[h]; if (s != null && StringUtils.isEqual(s.name, cs)) return s.requestContext; @NotNull String s2 = cs.toString(); @NotNull RequestContext rc = RequestContext.requestContext(cs); rc.seal(); interner[h] = new StringToRequestContext(s2, rc); return rc; }
@Nullable static <T> byte[] uncompress(@NotNull CharSequence cs, T t, @NotNull ThrowingFunction<T, byte[], IORuntimeException> bytes) throws IORuntimeException { switch (cs.charAt(0)) { case 'b': case '!': if (StringUtils.isEqual("binary", cs) || StringUtils.isEqual("!binary", cs)) return Compressions.Binary.uncompress(bytes.apply(t)); break; case 'l': if (StringUtils.isEqual("lzw", cs)) return Compressions.LZW.uncompress(bytes.apply(t)); break; case 's': if (StringUtils.isEqual("snappy", cs)) return Compressions.Snappy.uncompress(bytes.apply(t)); break; case 'g': if (StringUtils.isEqual("gzip", cs)) return Compressions.GZIP.uncompress(bytes.apply(t)); break; default: return null; } return null; }
if (StringUtils.isEqual(name, MetaDataKeys.header.name())) { wireStore = valueIn.typedMarshallable(); } else {