Tabnine Logo
MappedBytes.mappedBytes
Code IndexAdd Tabnine to your IDE (free)

How to use
mappedBytes
method
in
net.openhft.chronicle.bytes.MappedBytes

Best Java code snippets using net.openhft.chronicle.bytes.MappedBytes.mappedBytes (Showing top 20 results out of 315)

origin: OpenHFT/Chronicle-Queue

/**
 * @return creates a new instance of mapped bytes, because, for example the tailer and appender
 * can be at different locations.
 */
@NotNull
@Override
public MappedBytes bytes() {
  return MappedBytes.mappedBytes(mappedFile);
}
origin: OpenHFT/Chronicle-Queue

/**
 * @return creates a new instance of mapped bytes, because, for example the tailer and appender
 * can be at different locations.
 */
@NotNull
@Override
public MappedBytes bytes() {
  return MappedBytes.mappedBytes(mappedFile);
}
origin: OpenHFT/Chronicle-Queue

@NotNull
@Override
public String dump() {
  MappedBytes bytes = MappedBytes.mappedBytes(mappedFile);
  try {
    bytes.readLimit(bytes.realCapacity());
    return Wires.fromSizePrefixedBlobs(bytes);
  } finally {
    bytes.release();
  }
}
origin: OpenHFT/Chronicle-Queue

@NotNull
@Override
public String dump() {
  MappedBytes bytes = MappedBytes.mappedBytes(mappedFile);
  try {
    bytes.readLimit(bytes.realCapacity());
    return Wires.fromSizePrefixedBlobs(bytes);
  } finally {
    bytes.release();
  }
}
origin: OpenHFT/Chronicle-Queue

private static void dumpFile(@NotNull File file, @NotNull PrintStream out, long upperLimit) {
  Bytes<ByteBuffer> buffer = Bytes.elasticByteBuffer();
  try {
    MappedBytes bytes = MappedBytes.mappedBytes(file, 4 << 20, OS.pageSize(), !OS.isWindows());
    bytes.readLimit(bytes.realCapacity());
    StringBuilder sb = new StringBuilder();
origin: OpenHFT/Chronicle-Queue

long start1 = System.currentTimeMillis();
String filename = baseDir + "/" + count++;
queues[i] = MappedBytes.mappedBytes(filename, pagesPer10Second * (4 << 10));
long time1 = System.currentTimeMillis() - start1;
if (time1 > 20)
origin: OpenHFT/Chronicle-Queue

public void checkFileContents(@NotNull File file, String expected) throws FileNotFoundException {
  @NotNull MappedBytes bytes = MappedBytes.mappedBytes(file, ChronicleQueue.TEST_BLOCK_SIZE);
  bytes.readLimit(bytes.realCapacity());
  assertEquals(expected, Wires.fromSizePrefixedBlobs(bytes));
  bytes.release();
}
origin: OpenHFT/Chronicle-Queue

@Test
public void testInvalidFile() throws FileNotFoundException {
  @NotNull File dir = new File(OS.TARGET + "/deleteme-" + System.nanoTime());
  dir.mkdir();
  try (@NotNull MappedBytes bytes = MappedBytes.mappedBytes(new File(dir, "19700102" + SingleChronicleQueue.SUFFIX), 64 << 10)) {
    bytes.write8bit("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>");
    try (@NotNull RollingChronicleQueue queue = binary(dir)
        .rollCycle(RollCycles.TEST4_DAILY)
        .testBlockSize()
        .build()) {
      assertEquals(1, queue.firstCycle());
      assertEquals(1, queue.lastCycle());
      try {
        @NotNull ExcerptTailer tailer = queue.createTailer();
        tailer.toEnd();
        fail();
      } catch (Exception e) {
        assertEquals("java.io.StreamCorruptedException: Unexpected magic number 783f3c37",
            e.toString());
      }
    }
  }
  System.gc();
  try {
    IOTools.shallowDeleteDirWithFiles(dir.getAbsolutePath());
  } catch (Exception e) {
    e.printStackTrace();
  }
}
origin: OpenHFT/Chronicle-Queue

dir.mkdir();
@NotNull MappedBytes bytes = MappedBytes.mappedBytes(new File(dir, "19700101" + SingleChronicleQueue.SUFFIX), ChronicleQueue.TEST_BLOCK_SIZE);
@NotNull Wire wire = new BinaryWire(bytes);
try (DocumentContext dc = wire.writingDocument(true)) {
origin: OpenHFT/Chronicle-Queue

dir.mkdir();
@NotNull MappedBytes bytes = MappedBytes.mappedBytes(new File(dir, "19700101-02" + SingleChronicleQueue.SUFFIX), ChronicleQueue.TEST_BLOCK_SIZE * 2);
@NotNull Wire wire = new BinaryWire(bytes);
try (DocumentContext dc = wire.writingDocument(true)) {
origin: OpenHFT/Chronicle-Queue

dir.mkdirs();
@NotNull MappedBytes bytes = MappedBytes.mappedBytes(new File(dir, "19700101" + SingleChronicleQueue.SUFFIX),
    ChronicleQueue.TEST_BLOCK_SIZE * 2);
@NotNull Wire wire = new BinaryWire(bytes);
origin: OpenHFT/Chronicle-Queue

int dumpEntries = 0;
try {
  MappedBytes bytes = MappedBytes.mappedBytes(file, 4 << 20);
  bytes.readLimit(bytes.realCapacity());
origin: OpenHFT/Chronicle-Queue

private void removeEOF(Path path) throws IOException {
  long blockSize = 64 << 10;
  long chunkSize = OS.pageAlign(blockSize);
  long overlapSize = OS.pageAlign(blockSize / 4);
  final MappedBytes mappedBytes = MappedBytes.mappedBytes(path.toFile(), chunkSize, overlapSize, false);
  mappedBytes.reserve();
  try {
    final Wire wire = WireType.BINARY_LIGHT.apply(mappedBytes);
    final Bytes<?> bytes = wire.bytes();
    bytes.readLimit(bytes.capacity());
    bytes.readSkip(4);
    // move past header
    try (final SingleChronicleQueueStore qs = loadStore(wire)) {
      assertNotNull(qs);
      long l = qs.writePosition();
      long len = Wires.lengthOf(bytes.readVolatileInt(l));
      long eofOffset = l + len + 4L;
      bytes.writePosition(eofOffset);
      bytes.writeInt(0);
    }
  } finally {
    mappedBytes.release();
  }
}
origin: net.openhft/chronicle-queue

/**
 * @return creates a new instance of mapped bytes, because, for example the tailer and appender
 * can be at different locations.
 */
@NotNull
@Override
public MappedBytes bytes() {
  return MappedBytes.mappedBytes(mappedFile);
}
origin: net.openhft/chronicle-queue

/**
 * @return creates a new instance of mapped bytes, because, for example the tailer and appender
 * can be at different locations.
 */
@NotNull
@Override
public MappedBytes bytes() {
  return MappedBytes.mappedBytes(mappedFile);
}
origin: net.openhft/chronicle-bytes

@NotNull
public static MappedBytes mappedBytes(@NotNull File file, long chunkSize)
    throws FileNotFoundException, IllegalStateException {
  return mappedBytes(file, chunkSize, OS.pageSize());
}
origin: net.openhft/chronicle-bytes

@NotNull
public static MappedBytes mappedBytes(@NotNull File file, long chunkSize, long overlapSize)
    throws FileNotFoundException, IllegalStateException {
  @NotNull MappedFile rw = MappedFile.of(file, chunkSize, overlapSize, false);
  try {
    return mappedBytes(rw);
  } finally {
    rw.release();
  }
}
origin: net.openhft/chronicle-bytes

@NotNull
public MappedBytes withSizes(long chunkSize, long overlapSize) {
  @NotNull MappedFile mappedFile2 = this.mappedFile.withSizes(chunkSize, overlapSize);
  if (mappedFile2 == this.mappedFile)
    return this;
  try {
    return mappedBytes(mappedFile2);
  } finally {
    mappedFile2.release();
    release();
  }
}
origin: net.openhft/chronicle-queue

@NotNull
@Override
public String dump() {
  MappedBytes bytes = MappedBytes.mappedBytes(mappedFile);
  try {
    bytes.readLimit(bytes.realCapacity());
    return Wires.fromSizePrefixedBlobs(bytes);
  } finally {
    bytes.release();
  }
}
origin: peter-lawrey/Performance-Examples

public ChronicleBytesCASPingPongMain() throws IOException {
  bytes = MappedBytes.mappedBytes("deleteme", OS.pageSize());
  bytes.writeLong(COUNTER_OFFSET, 0L);
  bytes.writeInt(TOGGLE_OFFSET, 0);
}
net.openhft.chronicle.bytesMappedBytesmappedBytes

Popular methods of MappedBytes

  • addressForWrite
  • readLimit
  • readPosition
  • release
  • reserve
  • writePosition
  • writeSkip
  • mappedFile
  • readRemaining
  • realCapacity
  • start
  • writeLimit
  • start,
  • writeLimit,
  • writeLong,
  • <init>,
  • acquireNextByteStore,
  • acquireNextByteStore0,
  • append8bit0,
  • appendUtf8,
  • bytesStore

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now