@Override public void end() { writeStream.end(); }
/** * Same as {@link #end()} but writes some data to the stream before ending. */ default void end(T t) { write(t); end(); }
/** * Same as {@link #end()} but writes some data to the stream before ending. */ default void end(T t) { write(t); end(); }
@Override public void end() { if (stream instanceof AsyncFile) { AsyncFile file = (AsyncFile) stream; file.close(ar -> { if (ar.succeeded()) { fut.tryComplete(); } else { fut.tryFail(ar.cause()); } }); } else { stream.end(); fut.tryComplete(); } }
/** * Ends the stream. * <p> * Once the stream has ended, it cannot be used any more. */ public void end() { delegate.end(); }
@Override public void close() { writeStream.end(); } }
/** * Ends the stream. * <p> * Once the stream has ended, it cannot be used any more. */ public void end() { delegate.end(); }
@Override public void end() { wrappedWriteStream.end(); }
/** * Same as {@link io.vertx.rxjava.core.streams.WriteStream#end} but writes some data to the stream before ending. * @param t */ public void end(T t) { delegate.end(__typeArg_0.<T>unwrap(t)); }
/** * Same as {@link io.vertx.rxjava.core.streams.WriteStream#end} but writes some data to the stream before ending. * @param t */ public void end(T t) { delegate.end(__typeArg_0.<T>unwrap(t)); }
public static void end(io.vertx.core.streams.WriteStream<Object> j_receiver, java.lang.Object t) { j_receiver.end(io.vertx.core.impl.ConversionHelper.toObject(t)); } }
@Override public void end() { if (stream instanceof AsyncFile) { AsyncFile file = (AsyncFile) stream; file.close(ar -> { if (ar.succeeded()) { fut.tryComplete(); } else { fut.tryFail(ar.cause()); } }); } else { stream.end(); fut.tryComplete(); } }
private void streamChunkedBody(WriteStream<Buffer> stream, int num) { AtomicInteger count = new AtomicInteger(0); vertx.setPeriodic(10, id -> { int val = count.getAndIncrement(); if (val < num) { stream.write(Buffer.buffer("chunk-" + val)); } else { vertx.cancelTimer(id); stream.end(); } }); }
@Override public void onComplete() { if (!setDone()) { return; } Action a; synchronized (this) { a = flowableCompleteHandler; } try { writeStream.end(); if (a != null) { a.run(); } } catch (Throwable t) { Exceptions.throwIfFatal(t); RxJavaPlugins.onError(t); } }
/** * Test importing to a layer * @param context the test context */ @Test public void importLayer(TestContext context) { String url = "/store/hello/world/"; stubFor(post(urlEqualTo(url)) .willReturn(aResponse() .withStatus(202))); Async async = context.async(); WriteStream<Buffer> w = client.getStore().startImport("hello/world", context.asyncAssertSuccess(v -> { verifyPosted(url, XML, context); async.complete(); })); w.end(Buffer.buffer(XML)); }
/** * Test a simple import * @param context the test context */ @Test public void simpleImport(TestContext context) { String url = "/store"; stubFor(post(urlEqualTo(url)) .willReturn(aResponse() .withStatus(202))); Async async = context.async(); WriteStream<Buffer> w = client.getStore().startImport( context.asyncAssertSuccess(v -> { verifyPosted(url, XML, context); async.complete(); })); w.end(Buffer.buffer(XML)); }
/** * Test importing tags and properties * @param context the test context * @throws Exception if something goes wrong */ @Test public void importTagsAndProperties(TestContext context) throws Exception { String url = "/store?tags=testTag%2CtestTag2&props=hello%3Awo%5C%3Arld%2Challo2%3Aworld2"; stubFor(post(urlEqualTo(url)) .willReturn(aResponse() .withStatus(202))); Async async = context.async(); WriteStream<Buffer> w = client.getStore().startImport(new ImportParams() .addTags("testTag", "testTag2").addProperties("hello:wo\\:rld", "hallo2:world2"), context.asyncAssertSuccess(v -> { verifyPosted(url, XML, context); async.complete(); })); w.end(Buffer.buffer(XML)); }
/** * Test importing with tags * @param context the test context * @throws Exception if something goes wrong */ @Test public void importTags(TestContext context) throws Exception { String url = "/store?tags=hello%2Cworld"; stubFor(post(urlEqualTo(url)) .willReturn(aResponse() .withStatus(202))); Async async = context.async(); WriteStream<Buffer> w = client.getStore().startImport(new ImportParams() .addTags("hello", "world"), context.asyncAssertSuccess(v -> { verifyPosted(url, XML, context); async.complete(); })); w.end(Buffer.buffer(XML)); }
/** * Test importing properties * @param context the test context * @throws Exception if something goes wrong */ @Test public void importProperties(TestContext context) throws Exception { String url = "/store?props=hello%3Aworld%2Ckey%3Avalue"; stubFor(post(urlEqualTo(url)) .willReturn(aResponse() .withStatus(202))); Async async = context.async(); WriteStream<Buffer> w = client.getStore().startImport(new ImportParams() .addProperties("hello:world", "key:value"), context.asyncAssertSuccess(v -> { verifyPosted(url, XML, context); async.complete(); })); w.end(Buffer.buffer(XML)); }