congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Writeable
Code IndexAdd Tabnine to your IDE (free)

How to use
Writeable
in
org.elasticsearch.common.io.stream

Best Java code snippets using org.elasticsearch.common.io.stream.Writeable (Showing top 14 results out of 315)

origin: org.elasticsearch/elasticsearch

/**
 * Writes the specified array of {@link Writeable}s. This method can be seen as
 * writer version of {@link StreamInput#readArray(Writeable.Reader, IntFunction)}. The length of array encoded as a variable-length
 * integer is first written to the stream, and then the elements of the array are written to the stream.
 */
public <T extends Writeable> void writeArray(T[] array) throws IOException {
  writeArray((out, value) -> value.writeTo(out), array);
}
origin: org.elasticsearch/elasticsearch

/**
 * Writes a list of {@link Writeable} objects
 */
public void writeList(List<? extends Writeable> list) throws IOException {
  writeVInt(list.size());
  for (Writeable obj: list) {
    obj.writeTo(this);
  }
}
origin: org.elasticsearch/elasticsearch

/**
 * Same as {@link #writeArray(Writeable[])} but the provided array may be null. An additional boolean value is
 * serialized to indicate whether the array was null or not.
 */
public <T extends Writeable> void writeOptionalArray(@Nullable T[] array) throws IOException {
  writeOptionalArray((out, value) -> value.writeTo(out), array);
}
origin: org.elasticsearch/elasticsearch

public void writeOptionalWriteable(@Nullable Writeable writeable) throws IOException {
  if (writeable != null) {
    writeBoolean(true);
    writeable.writeTo(this);
  } else {
    writeBoolean(false);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

public <T extends Writeable> void writeArray(T[] array) throws IOException {
  writeVInt(array.length);
  for (T value: array) {
    value.writeTo(this);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Writes a list of {@link Writeable} objects
 */
public void writeList(List<? extends Writeable> list) throws IOException {
  writeVInt(list.size());
  for (Writeable obj: list) {
    obj.writeTo(this);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public <T extends Writeable> void writeArray(T[] array) throws IOException {
  writeVInt(array.length);
  for (T value: array) {
    value.writeTo(this);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Writes a list of {@link Writeable} objects
 */
public void writeList(List<? extends Writeable> list) throws IOException {
  writeVInt(list.size());
  for (Writeable obj: list) {
    obj.writeTo(this);
  }
}
origin: harbby/presto-connectors

  /**
   * Writes a list of {@link Writeable} objects
   */
  public <T extends Writeable<T>> void writeList(List<T> list) throws IOException {
    writeVInt(list.size());
    for (T obj: list) {
      obj.writeTo(this);
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public void writeOptionalWriteable(@Nullable Writeable writeable) throws IOException {
  if (writeable != null) {
    writeBoolean(true);
    writeable.writeTo(this);
  } else {
    writeBoolean(false);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

public void writeOptionalWriteable(@Nullable Writeable writeable) throws IOException {
  if (writeable != null) {
    writeBoolean(true);
    writeable.writeTo(this);
  } else {
    writeBoolean(false);
  }
}
origin: com.strapdata.elasticsearch.test/framework

/**
 * Simulates sending diffs over the wire
 */
public static <T extends Writeable> T copyInstance(T diffs, NamedWriteableRegistry namedWriteableRegistry,
                               Reader<T> reader) throws IOException {
  try (BytesStreamOutput output = new BytesStreamOutput()) {
    diffs.writeTo(output);
    try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) {
      return reader.read(in);
    }
  }
}
origin: com.strapdata.elasticsearch.test/framework

/**
 * Create a copy of an original {@link Writeable} object by running it through a {@link BytesStreamOutput} and
 * reading it in again using a provided {@link Writeable.Reader}. The stream that is wrapped around the {@link StreamInput}
 * potentially need to use a {@link NamedWriteableRegistry}, so this needs to be provided too (although it can be
 * empty if the object that is streamed doesn't contain any {@link NamedWriteable} objects itself.
 */
public static <T extends Writeable> T copyWriteable(T original, NamedWriteableRegistry namedWritabelRegistry,
    Writeable.Reader<T> reader) throws IOException {
  try (BytesStreamOutput output = new BytesStreamOutput()) {
    original.writeTo(output);
    try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWritabelRegistry)) {
      return reader.read(in);
    }
  }
}
origin: com.strapdata.elasticsearch.test/framework

protected T copyInstance(T instance, Version version) throws IOException {
  try (BytesStreamOutput output = new BytesStreamOutput()) {
    output.setVersion(version);
    instance.writeTo(output);
    try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(),
        getNamedWriteableRegistry())) {
      in.setVersion(version);
      return instanceReader().read(in);
    }
  }
}
org.elasticsearch.common.io.streamWriteable

Javadoc

Implementers can be written to a StreamOutput and read from a StreamInput. This allows them to be "thrown across the wire" using Elasticsearch's internal protocol. If the implementer also implements equals and hashCode then a copy made by serializing and deserializing must be equal and have the same hashCode. It isn't required that such a copy be entirely unchanged.

Prefer implementing this interface over implementing Streamable where possible. Lots of code depends on Streamableso this isn't always possible.

Most used methods

  • writeTo
    Write this into the StreamOutput.

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • BoxLayout (javax.swing)
  • Top Sublime Text 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