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

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

Best Java code snippets using org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput.reset (Showing top 4 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: 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());
  }
}
org.elasticsearch.common.io.streamReleasableBytesStreamOutputreset

Popular methods of ReleasableBytesStreamOutput

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

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JCheckBox (javax.swing)
  • Top plugins for Android Studio
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