@Override public boolean put(String key, @NotNull String value) { Buffers b = BUFFERS.get(); Bytes<ByteBuffer> bytes = b.valueBuffer; bytes.clear(); bytes.append8bit(value); return kvStore.put(key, bytes); }
private void dumpRules(@NotNull Wire wire) { wire.bytes().append8bit("---\n"); wire.write("name").text(fullName()) .write("leaf").marshallable(w -> { for (@NotNull Map.Entry<Class, LeafView> entry : leafViewMap.entrySet()) { w.writeEvent(Class.class, entry.getKey()).leaf(false) .text(entry.getValue().name); } }) .write("wrapping").marshallable(w -> { for (@NotNull Map.Entry<Class, SortedMap<String, WrappingViewRecord>> entry : wrappingViewFactoryMap.entrySet()) { w.writeEvent(Class.class, entry.getKey()).marshallable(ww -> { for (@NotNull Map.Entry<String, WrappingViewRecord> recordEntry : entry.getValue().entrySet()) { ww.writeEventName(recordEntry.getKey()).object(Class.class, recordEntry.getValue().underlyingType); } }); } }); }
MappedUniqueMicroTimeProvider() { try { file = MappedFile.mappedFile(OS.TMP + "/.time-stamp.dat", OS.pageSize(), 0); bytes = file.acquireBytesForWrite(0); bytes.append8bit("&TSF\nTime stamp file uses for sharing a unique id\n"); BytesUtil.unregister(bytes); } catch (IOException ioe) { throw new IORuntimeException(ioe); } }
private static void testBytes() { Bytes bytes = Bytes.allocateDirect(32); long start = System.currentTimeMillis(); int count = 500000; for (int i = 0; i < count; i++) { bytes.clear(); String s = "a,b,c,d,1,2,3,4"; bytes.append8bit(s); a = bytes.parseUtf8(StopCharTesters.COMMA_STOP); b = bytes.parseUtf8(StopCharTesters.COMMA_STOP); c = bytes.parseUtf8(StopCharTesters.COMMA_STOP); d = bytes.parseUtf8(StopCharTesters.COMMA_STOP); e = (int) bytes.parseLong(); f = (int) bytes.parseLong(); g = (int) bytes.parseLong(); h = (int) bytes.parseLong(); } long time = (System.currentTimeMillis() - start) * 100000 / count; System.out.println("Bytes: Average time " + time / 1e2 + "us."); } }