Tabnine Logo
Streams.flushOnCloseStream
Code IndexAdd Tabnine 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)

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

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • getSupportFragmentManager (FragmentActivity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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