Codota Logo
Streams.flushOnCloseStream
Code IndexAdd Codota to your IDE (free)

How to use
flushOnCloseStream
method
in
org.elasticsearch.common.io.Streams

Best Java code snippets using org.elasticsearch.common.io.Streams.flushOnCloseStream (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.elasticsearch/elasticsearch

CompressibleBytesOutputStream(BytesStream bytesStreamOutput, boolean shouldCompress) throws IOException {
  this.bytesStreamOutput = bytesStreamOutput;
  this.shouldCompress = shouldCompress;
  if (shouldCompress) {
    this.stream = CompressorFactory.COMPRESSOR.streamOutput(Streams.flushOnCloseStream(bytesStreamOutput));
  } else {
    this.stream = bytesStreamOutput;
  }
}
origin: org.elasticsearch/elasticsearch

OutputStream unclosableOutputStream = Streams.flushOnCloseStream(bytesOutput());
XContentBuilder builder =
  new XContentBuilder(XContentFactory.xContent(responseContentType), unclosableOutputStream, includes, excludes);
origin: org.elasticsearch/elasticsearch

int[] width = buildWidths(table, request, verbose, headers);
BytesStream bytesOut = Streams.flushOnCloseStream(channel.bytesOutput());
UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOut);
int lastHeader = headers.size() - 1;
origin: org.elasticsearch/elasticsearch

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  boolean helpWanted = request.paramAsBoolean("help", false);
  if (helpWanted) {
    return channel -> {
      Table table = getTableWithHeader(request);
      int[] width = buildHelpWidths(table, request);
      BytesStream bytesOutput = Streams.flushOnCloseStream(channel.bytesOutput());
      UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOutput);
      for (Table.Cell cell : table.getHeaders()) {
        // need to do left-align always, so create new cells
        pad(new Table.Cell(cell.value), width[0], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("alias") ? cell.attr.get("alias") : ""), width[1], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("desc") ? cell.attr.get("desc") : "not available"), width[2], request, out);
        out.append("\n");
      }
      out.close();
      channel.sendResponse(new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOutput.bytes()));
    };
  } else {
    return doCatRequest(request, client);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

CompressibleBytesOutputStream(BytesStream bytesStreamOutput, boolean shouldCompress) throws IOException {
  this.bytesStreamOutput = bytesStreamOutput;
  this.shouldCompress = shouldCompress;
  if (shouldCompress) {
    this.stream = CompressorFactory.COMPRESSOR.streamOutput(Streams.flushOnCloseStream(bytesStreamOutput));
  } else {
    this.stream = bytesStreamOutput;
  }
}
origin: apache/servicemix-bundles

CompressibleBytesOutputStream(BytesStream bytesStreamOutput, boolean shouldCompress) throws IOException {
  this.bytesStreamOutput = bytesStreamOutput;
  this.shouldCompress = shouldCompress;
  if (shouldCompress) {
    this.stream = CompressorFactory.COMPRESSOR.streamOutput(Streams.flushOnCloseStream(bytesStreamOutput));
  } else {
    this.stream = bytesStreamOutput;
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

OutputStream unclosableOutputStream = Streams.flushOnCloseStream(bytesOutput());
XContentBuilder builder =
  new XContentBuilder(XContentFactory.xContent(responseContentType), unclosableOutputStream, includes, excludes);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

OutputStream unclosableOutputStream = Streams.flushOnCloseStream(bytesOutput());
XContentBuilder builder =
  new XContentBuilder(XContentFactory.xContent(responseContentType), unclosableOutputStream, includes, excludes);
origin: apache/servicemix-bundles

OutputStream unclosableOutputStream = Streams.flushOnCloseStream(bytesOutput());
XContentBuilder builder =
  new XContentBuilder(XContentFactory.xContent(responseContentType), unclosableOutputStream, includes, excludes);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

int[] width = buildWidths(table, request, verbose, headers);
BytesStream bytesOut = Streams.flushOnCloseStream(channel.bytesOutput());
UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOut);
int lastHeader = headers.size() - 1;
origin: com.strapdata.elasticsearch/elasticsearch

int[] width = buildWidths(table, request, verbose, headers);
BytesStream bytesOut = Streams.flushOnCloseStream(channel.bytesOutput());
UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOut);
int lastHeader = headers.size() - 1;
origin: apache/servicemix-bundles

int[] width = buildWidths(table, request, verbose, headers);
BytesStream bytesOut = Streams.flushOnCloseStream(channel.bytesOutput());
UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOut);
int lastHeader = headers.size() - 1;
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  boolean helpWanted = request.paramAsBoolean("help", false);
  if (helpWanted) {
    return channel -> {
      Table table = getTableWithHeader(request);
      int[] width = buildHelpWidths(table, request);
      BytesStream bytesOutput = Streams.flushOnCloseStream(channel.bytesOutput());
      UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOutput);
      for (Table.Cell cell : table.getHeaders()) {
        // need to do left-align always, so create new cells
        pad(new Table.Cell(cell.value), width[0], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("alias") ? cell.attr.get("alias") : ""), width[1], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("desc") ? cell.attr.get("desc") : "not available"), width[2], request, out);
        out.append("\n");
      }
      out.close();
      channel.sendResponse(new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOutput.bytes()));
    };
  } else {
    return doCatRequest(request, client);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  boolean helpWanted = request.paramAsBoolean("help", false);
  if (helpWanted) {
    return channel -> {
      Table table = getTableWithHeader(request);
      int[] width = buildHelpWidths(table, request);
      BytesStream bytesOutput = Streams.flushOnCloseStream(channel.bytesOutput());
      UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOutput);
      for (Table.Cell cell : table.getHeaders()) {
        // need to do left-align always, so create new cells
        pad(new Table.Cell(cell.value), width[0], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("alias") ? cell.attr.get("alias") : ""), width[1], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("desc") ? cell.attr.get("desc") : "not available"), width[2], request, out);
        out.append("\n");
      }
      out.close();
      channel.sendResponse(new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOutput.bytes()));
    };
  } else {
    return doCatRequest(request, client);
  }
}
origin: apache/servicemix-bundles

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  boolean helpWanted = request.paramAsBoolean("help", false);
  if (helpWanted) {
    return channel -> {
      Table table = getTableWithHeader(request);
      int[] width = buildHelpWidths(table, request);
      BytesStream bytesOutput = Streams.flushOnCloseStream(channel.bytesOutput());
      UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOutput);
      for (Table.Cell cell : table.getHeaders()) {
        // need to do left-align always, so create new cells
        pad(new Table.Cell(cell.value), width[0], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("alias") ? cell.attr.get("alias") : ""), width[1], request, out);
        out.append(" | ");
        pad(new Table.Cell(cell.attr.containsKey("desc") ? cell.attr.get("desc") : "not available"), width[2], request, out);
        out.append("\n");
      }
      out.close();
      channel.sendResponse(new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOutput.bytes()));
    };
  } else {
    return doCatRequest(request, client);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

StreamOutput stream = Streams.flushOnCloseStream(bStream);
try {
  if (options.compress()) {
origin: com.strapdata.elasticsearch/elasticsearch

ReleasableBytesStreamOutput bStream = new ReleasableBytesStreamOutput(bigArrays);
boolean addedReleaseListener = false;
StreamOutput stream = Streams.flushOnCloseStream(bStream);
try {
org.elasticsearch.common.ioStreamsflushOnCloseStream

Javadoc

Wraps the given BytesStream in a StreamOutput that simply flushes when close is called.

Popular methods of Streams

  • copyToString
    Copy the contents of the given Reader into a String. Closes the reader when done.
  • copy
    Copy the contents of the given byte array to the given OutputStream. Closes the stream when done.
  • copyToByteArray
  • readAllLines
  • readFully
  • copyToStringFromClasspath

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getExternalFilesDir (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Path (java.nio.file)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Runner (org.openjdk.jmh.runner)
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now