Tabnine Logo
ReleasableBytesStreamOutput.seek
Code IndexAdd Tabnine to your IDE (free)

How to use
seek
method
in
org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput

Best Java code snippets using org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput.seek (Showing top 8 results out of 315)

origin: org.elasticsearch/elasticsearch

/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput, String)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
  final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
  try {
    outStream.writeInt(toWrite.size());
    final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
    for (Operation op : toWrite) {
      out.reset();
      final long start = out.position();
      out.skip(Integer.BYTES);
      writeOperationNoSize(checksumStreamOutput, op);
      long end = out.position();
      int operationSize = (int) (out.position() - Integer.BYTES - start);
      out.seek(start);
      out.writeInt(operationSize);
      out.seek(end);
      ReleasablePagedBytesReference bytes = out.bytes();
      bytes.writeTo(outStream);
    }
  } finally {
    Releasables.close(out);
  }
}
origin: org.elasticsearch/elasticsearch

final long end = out.position();
final int operationSize = (int) (end - Integer.BYTES - start);
out.seek(start);
out.writeInt(operationSize);
out.seek(end);
final ReleasablePagedBytesReference bytes = out.bytes();
try (ReleasableLock ignored = readLock.acquire()) {
origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
  final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
  try {
    outStream.writeInt(toWrite.size());
    final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
    for (Operation op : toWrite) {
      out.reset();
      final long start = out.position();
      out.skip(Integer.BYTES);
      writeOperationNoSize(checksumStreamOutput, op);
      long end = out.position();
      int operationSize = (int) (out.position() - Integer.BYTES - start);
      out.seek(start);
      out.writeInt(operationSize);
      out.seek(end);
      ReleasablePagedBytesReference bytes = out.bytes();
      bytes.writeTo(outStream);
    }
  } finally {
    Releasables.close(out);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput, String)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
  final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
  try {
    outStream.writeInt(toWrite.size());
    final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
    for (Operation op : toWrite) {
      out.reset();
      final long start = out.position();
      out.skip(Integer.BYTES);
      writeOperationNoSize(checksumStreamOutput, op);
      long end = out.position();
      int operationSize = (int) (out.position() - Integer.BYTES - start);
      out.seek(start);
      out.writeInt(operationSize);
      out.seek(end);
      ReleasablePagedBytesReference bytes = out.bytes();
      bytes.writeTo(outStream);
    }
  } finally {
    Releasables.close(out);
  }
}
origin: harbby/presto-connectors

/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
  final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
  try {
    outStream.writeInt(toWrite.size());
    final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
    for (Operation op : toWrite) {
      out.reset();
      final long start = out.position();
      out.skip(RamUsageEstimator.NUM_BYTES_INT);
      writeOperationNoSize(checksumStreamOutput, op);
      long end = out.position();
      int operationSize = (int) (out.position() - RamUsageEstimator.NUM_BYTES_INT - start);
      out.seek(start);
      out.writeInt(operationSize);
      out.seek(end);
      ReleasablePagedBytesReference bytes = out.bytes();
      bytes.writeTo(outStream);
    }
  } finally {
    Releasables.close(out.bytes());
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

final long end = out.position();
final int operationSize = (int) (end - Integer.BYTES - start);
out.seek(start);
out.writeInt(operationSize);
out.seek(end);
final ReleasablePagedBytesReference bytes = out.bytes();
try (ReleasableLock ignored = readLock.acquire()) {
origin: apache/servicemix-bundles

final long end = out.position();
final int operationSize = (int) (end - Integer.BYTES - start);
out.seek(start);
out.writeInt(operationSize);
out.seek(end);
final ReleasablePagedBytesReference bytes = out.bytes();
try (ReleasableLock ignored = readLock.acquire()) {
origin: harbby/presto-connectors

final long end = out.position();
final int operationSize = (int) (end - RamUsageEstimator.NUM_BYTES_INT - start);
out.seek(start);
out.writeInt(operationSize);
out.seek(end);
final ReleasablePagedBytesReference bytes = out.bytes();
try (ReleasableLock lock = readLock.acquire()) {
org.elasticsearch.common.io.streamReleasableBytesStreamOutputseek

Popular methods of ReleasableBytesStreamOutput

  • <init>
  • bytes
    Returns a Releasable implementation of a org.elasticsearch.common.bytes.BytesReference that represen
  • position
  • reset
  • skip
  • writeInt
  • size
  • writeByte

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JCheckBox (javax.swing)
  • Top Vim plugins
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