/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava.core.file;

import java.util.Map;
import rx.Observable;
import rx.Single;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

Represents a file on the file-system which can be read from, or written to asynchronously.

This class also implements ReadStream and WriteStream. This allows the data to be pumped to and from other streams, e.g. an HttpClientRequest instance, using the Pump class

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * Represents a file on the file-system which can be read from, or written to asynchronously. * <p> * This class also implements {@link io.vertx.rxjava.core.streams.ReadStream} and * {@link io.vertx.rxjava.core.streams.WriteStream}. This allows the data to be pumped to and from * other streams, e.g. an {@link io.vertx.rxjava.core.http.HttpClientRequest} instance, * using the {@link io.vertx.rxjava.core.streams.Pump} class * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.core.file.AsyncFile original} non RX-ified interface using Vert.x codegen. */
@io.vertx.lang.rx.RxGen(io.vertx.core.file.AsyncFile.class) public class AsyncFile implements io.vertx.rxjava.core.streams.ReadStream<io.vertx.rxjava.core.buffer.Buffer>, io.vertx.rxjava.core.streams.WriteStream<io.vertx.rxjava.core.buffer.Buffer> { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AsyncFile that = (AsyncFile) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rx.TypeArg<AsyncFile> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new AsyncFile((io.vertx.core.file.AsyncFile) obj), AsyncFile::getDelegate ); private final io.vertx.core.file.AsyncFile delegate; public AsyncFile(io.vertx.core.file.AsyncFile delegate) { this.delegate = delegate; } public io.vertx.core.file.AsyncFile getDelegate() { return delegate; } private rx.Observable<io.vertx.rxjava.core.buffer.Buffer> observable; public synchronized rx.Observable<io.vertx.rxjava.core.buffer.Buffer> toObservable() { if (observable == null) { java.util.function.Function<io.vertx.core.buffer.Buffer, io.vertx.rxjava.core.buffer.Buffer> conv = io.vertx.rxjava.core.buffer.Buffer::newInstance; observable = io.vertx.rx.java.RxHelper.toObservable(delegate, conv); } return observable; } private io.vertx.rx.java.WriteStreamSubscriber<io.vertx.rxjava.core.buffer.Buffer> subscriber; public synchronized io.vertx.rx.java.WriteStreamSubscriber<io.vertx.rxjava.core.buffer.Buffer> toSubscriber() { if (subscriber == null) { java.util.function.Function<io.vertx.rxjava.core.buffer.Buffer, io.vertx.core.buffer.Buffer> conv = io.vertx.rxjava.core.buffer.Buffer::getDelegate; subscriber = io.vertx.rx.java.RxHelper.toSubscriber(getDelegate(), conv); } return subscriber; }
Same as end but writes some data to the stream before ending.
Params:
  • data – the data to write
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#end} but writes some data to the stream before ending. * @param data the data to write */
public void end(io.vertx.rxjava.core.buffer.Buffer data) { delegate.end(data.getDelegate()); }
Same as but with an handler called when the operation completes
Params:
  • data –
  • handler –
/** * Same as but with an <code>handler</code> called when the operation completes * @param data * @param handler */
public void end(io.vertx.rxjava.core.buffer.Buffer data, Handler<AsyncResult<Void>> handler) { delegate.end(data.getDelegate(), handler); }
Same as but with an handler called when the operation completes
Params:
  • data –
Returns:
Deprecated:use rxEnd instead
/** * Same as but with an <code>handler</code> called when the operation completes * @param data * @return * @deprecated use {@link #rxEnd} instead */
@Deprecated() public Observable<Void> endObservable(io.vertx.rxjava.core.buffer.Buffer data) { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); end(data, handler.toHandler()); return handler; }
Same as but with an handler called when the operation completes
Params:
  • data –
Returns:
/** * Same as but with an <code>handler</code> called when the operation completes * @param data * @return */
public Single<Void> rxEnd(io.vertx.rxjava.core.buffer.Buffer data) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { end(data, fut); })); }
This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize
Returns:true if write queue is full
/** * This will return <code>true</code> if there are more bytes in the write queue than the value set using {@link io.vertx.rxjava.core.file.AsyncFile#setWriteQueueMaxSize} * @return true if write queue is full */
public boolean writeQueueFull() { boolean ret = delegate.writeQueueFull(); return ret; }
Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.
Returns:a pipe
/** * Pause this stream and return a to transfer the elements of this stream to a destination . * <p/> * The stream will be resumed when the pipe will be wired to a <code>WriteStream</code>. * @return a pipe */
public io.vertx.rxjava.core.streams.Pipe<io.vertx.rxjava.core.buffer.Buffer> pipe() { io.vertx.rxjava.core.streams.Pipe<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.core.streams.Pipe.newInstance(delegate.pipe(), (io.vertx.lang.rx.TypeArg)io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
Like ReadStream.pipeTo but with no completion handler.
Params:
  • dst –
/** * Like {@link io.vertx.rxjava.core.streams.ReadStream#pipeTo} but with no completion handler. * @param dst */
public void pipeTo(io.vertx.rxjava.core.streams.WriteStream<io.vertx.rxjava.core.buffer.Buffer> dst) { delegate.pipeTo(dst.getDelegate()); }
Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Params:
  • dst – the destination write stream
  • handler –
/** * Pipe this <code>ReadStream</code> to the <code>WriteStream</code>. * <p> * Elements emitted by this stream will be written to the write stream until this stream ends or fails. * <p> * Once this stream has ended or failed, the write stream will be ended and the <code>handler</code> will be * called with the result. * @param dst the destination write stream * @param handler */
public void pipeTo(io.vertx.rxjava.core.streams.WriteStream<io.vertx.rxjava.core.buffer.Buffer> dst, Handler<AsyncResult<Void>> handler) { delegate.pipeTo(dst.getDelegate(), handler); }
Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Params:
  • dst – the destination write stream
Returns:
Deprecated:use rxPipeTo instead
/** * Pipe this <code>ReadStream</code> to the <code>WriteStream</code>. * <p> * Elements emitted by this stream will be written to the write stream until this stream ends or fails. * <p> * Once this stream has ended or failed, the write stream will be ended and the <code>handler</code> will be * called with the result. * @param dst the destination write stream * @return * @deprecated use {@link #rxPipeTo} instead */
@Deprecated() public Observable<Void> pipeToObservable(io.vertx.rxjava.core.streams.WriteStream<io.vertx.rxjava.core.buffer.Buffer> dst) { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); pipeTo(dst, handler.toHandler()); return handler; }
Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Params:
  • dst – the destination write stream
Returns:
/** * Pipe this <code>ReadStream</code> to the <code>WriteStream</code>. * <p> * Elements emitted by this stream will be written to the write stream until this stream ends or fails. * <p> * Once this stream has ended or failed, the write stream will be ended and the <code>handler</code> will be * called with the result. * @param dst the destination write stream * @return */
public Single<Void> rxPipeTo(io.vertx.rxjava.core.streams.WriteStream<io.vertx.rxjava.core.buffer.Buffer> dst) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { pipeTo(dst, fut); })); } public io.vertx.rxjava.core.file.AsyncFile handler(Handler<io.vertx.rxjava.core.buffer.Buffer> handler) { delegate.handler(new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { handler.handle(io.vertx.rxjava.core.buffer.Buffer.newInstance(event)); } }); return this; } public io.vertx.rxjava.core.file.AsyncFile pause() { delegate.pause(); return this; } public io.vertx.rxjava.core.file.AsyncFile resume() { delegate.resume(); return this; } public io.vertx.rxjava.core.file.AsyncFile endHandler(Handler<Void> endHandler) { delegate.endHandler(endHandler); return this; } public io.vertx.rxjava.core.file.AsyncFile write(io.vertx.rxjava.core.buffer.Buffer data) { delegate.write(data.getDelegate()); return this; }
Same as write but with an handler called when the operation completes
Params:
  • data –
  • handler –
Returns:
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#write} but with an <code>handler</code> called when the operation completes * @param data * @param handler * @return */
public io.vertx.rxjava.core.file.AsyncFile write(io.vertx.rxjava.core.buffer.Buffer data, Handler<AsyncResult<Void>> handler) { delegate.write(data.getDelegate(), handler); return this; }
Same as write but with an handler called when the operation completes
Params:
  • data –
Returns:
Deprecated:use rxWrite instead
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#write} but with an <code>handler</code> called when the operation completes * @param data * @return * @deprecated use {@link #rxWrite} instead */
@Deprecated() public Observable<Void> writeObservable(io.vertx.rxjava.core.buffer.Buffer data) { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); write(data, handler.toHandler()); return handler; }
Same as write but with an handler called when the operation completes
Params:
  • data –
Returns:
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#write} but with an <code>handler</code> called when the operation completes * @param data * @return */
public Single<Void> rxWrite(io.vertx.rxjava.core.buffer.Buffer data) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { write(data, fut); })); } public io.vertx.rxjava.core.file.AsyncFile setWriteQueueMaxSize(int maxSize) { delegate.setWriteQueueMaxSize(maxSize); return this; } public io.vertx.rxjava.core.file.AsyncFile drainHandler(Handler<Void> handler) { delegate.drainHandler(handler); return this; } public io.vertx.rxjava.core.file.AsyncFile exceptionHandler(Handler<Throwable> handler) { delegate.exceptionHandler(handler); return this; } public io.vertx.rxjava.core.file.AsyncFile fetch(long amount) { delegate.fetch(amount); return this; }
Close the file, see close.
/** * Close the file, see {@link io.vertx.rxjava.core.file.AsyncFile#close}. */
public void end() { delegate.end(); }
Close the file, see close.
Params:
  • handler –
/** * Close the file, see {@link io.vertx.rxjava.core.file.AsyncFile#close}. * @param handler */
public void end(Handler<AsyncResult<Void>> handler) { delegate.end(handler); }
Close the file, see close.
Returns:
Deprecated:use rxEnd instead
/** * Close the file, see {@link io.vertx.rxjava.core.file.AsyncFile#close}. * @return * @deprecated use {@link #rxEnd} instead */
@Deprecated() public Observable<Void> endObservable() { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); end(handler.toHandler()); return handler; }
Close the file, see close.
Returns:
/** * Close the file, see {@link io.vertx.rxjava.core.file.AsyncFile#close}. * @return */
public Single<Void> rxEnd() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { end(fut); })); }
Close the file. The actual close happens asynchronously.
/** * Close the file. The actual close happens asynchronously. */
public void close() { delegate.close(); }
Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs.
Params:
  • handler – the handler
/** * Close the file. The actual close happens asynchronously. * The handler will be called when the close is complete, or an error occurs. * @param handler the handler */
public void close(Handler<AsyncResult<Void>> handler) { delegate.close(handler); }
Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs.
Returns:
Deprecated:use rxClose instead
/** * Close the file. The actual close happens asynchronously. * The handler will be called when the close is complete, or an error occurs. * @return * @deprecated use {@link #rxClose} instead */
@Deprecated() public Observable<Void> closeObservable() { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); close(handler.toHandler()); return handler; }
Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs.
Returns:
/** * Close the file. The actual close happens asynchronously. * The handler will be called when the close is complete, or an error occurs. * @return */
public Single<Void> rxClose() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { close(fut); })); }
Write a Buffer to the file at position position in the file, asynchronously.

If position lies outside of the current size of the file, the file will be enlarged to encompass it.

When multiple writes are invoked on the same file there are no guarantees as to order in which those writes actually occur

The handler will be called when the write is complete, or if an error occurs.

Params:
  • buffer – the buffer to write
  • position – the position in the file to write it at
  • handler – the handler to call when the write is complete
Returns:a reference to this, so the API can be used fluently
/** * Write a {@link io.vertx.rxjava.core.buffer.Buffer} to the file at position <code>position</code> in the file, asynchronously. * <p> * If <code>position</code> lies outside of the current size * of the file, the file will be enlarged to encompass it. * <p> * When multiple writes are invoked on the same file * there are no guarantees as to order in which those writes actually occur * <p> * The handler will be called when the write is complete, or if an error occurs. * @param buffer the buffer to write * @param position the position in the file to write it at * @param handler the handler to call when the write is complete * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile write(io.vertx.rxjava.core.buffer.Buffer buffer, long position, Handler<AsyncResult<Void>> handler) { delegate.write(buffer.getDelegate(), position, handler); return this; }
Write a Buffer to the file at position position in the file, asynchronously.

If position lies outside of the current size of the file, the file will be enlarged to encompass it.

When multiple writes are invoked on the same file there are no guarantees as to order in which those writes actually occur

The handler will be called when the write is complete, or if an error occurs.

Params:
  • buffer – the buffer to write
  • position – the position in the file to write it at
Returns:a reference to this, so the API can be used fluently
Deprecated:use rxWrite instead
/** * Write a {@link io.vertx.rxjava.core.buffer.Buffer} to the file at position <code>position</code> in the file, asynchronously. * <p> * If <code>position</code> lies outside of the current size * of the file, the file will be enlarged to encompass it. * <p> * When multiple writes are invoked on the same file * there are no guarantees as to order in which those writes actually occur * <p> * The handler will be called when the write is complete, or if an error occurs. * @param buffer the buffer to write * @param position the position in the file to write it at * @return a reference to this, so the API can be used fluently * @deprecated use {@link #rxWrite} instead */
@Deprecated() public Observable<Void> writeObservable(io.vertx.rxjava.core.buffer.Buffer buffer, long position) { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); write(buffer, position, handler.toHandler()); return handler; }
Write a Buffer to the file at position position in the file, asynchronously.

If position lies outside of the current size of the file, the file will be enlarged to encompass it.

When multiple writes are invoked on the same file there are no guarantees as to order in which those writes actually occur

The handler will be called when the write is complete, or if an error occurs.

Params:
  • buffer – the buffer to write
  • position – the position in the file to write it at
Returns:a reference to this, so the API can be used fluently
/** * Write a {@link io.vertx.rxjava.core.buffer.Buffer} to the file at position <code>position</code> in the file, asynchronously. * <p> * If <code>position</code> lies outside of the current size * of the file, the file will be enlarged to encompass it. * <p> * When multiple writes are invoked on the same file * there are no guarantees as to order in which those writes actually occur * <p> * The handler will be called when the write is complete, or if an error occurs. * @param buffer the buffer to write * @param position the position in the file to write it at * @return a reference to this, so the API can be used fluently */
public Single<Void> rxWrite(io.vertx.rxjava.core.buffer.Buffer buffer, long position) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { write(buffer, position, fut); })); }
Reads length bytes of data from the file at position position in the file, asynchronously.

The read data will be written into the specified Buffer buffer at position offset.

If data is read past the end of the file then zero bytes will be read.

When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur.

The handler will be called when the close is complete, or if an error occurs.

Params:
  • buffer – the buffer to read into
  • offset – the offset into the buffer where the data will be read
  • position – the position in the file where to start reading
  • length – the number of bytes to read
  • handler – the handler to call when the write is complete
Returns:a reference to this, so the API can be used fluently
/** * Reads <code>length</code> bytes of data from the file at position <code>position</code> in the file, asynchronously. * <p> * The read data will be written into the specified <code>Buffer buffer</code> at position <code>offset</code>. * <p> * If data is read past the end of the file then zero bytes will be read.<p> * When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur. * <p> * The handler will be called when the close is complete, or if an error occurs. * @param buffer the buffer to read into * @param offset the offset into the buffer where the data will be read * @param position the position in the file where to start reading * @param length the number of bytes to read * @param handler the handler to call when the write is complete * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile read(io.vertx.rxjava.core.buffer.Buffer buffer, int offset, long position, int length, Handler<AsyncResult<io.vertx.rxjava.core.buffer.Buffer>> handler) { delegate.read(buffer.getDelegate(), offset, position, length, new Handler<AsyncResult<io.vertx.core.buffer.Buffer>>() { public void handle(AsyncResult<io.vertx.core.buffer.Buffer> ar) { if (ar.succeeded()) { handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.core.buffer.Buffer.newInstance(ar.result()))); } else { handler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Reads length bytes of data from the file at position position in the file, asynchronously.

The read data will be written into the specified Buffer buffer at position offset.

If data is read past the end of the file then zero bytes will be read.

When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur.

The handler will be called when the close is complete, or if an error occurs.

Params:
  • buffer – the buffer to read into
  • offset – the offset into the buffer where the data will be read
  • position – the position in the file where to start reading
  • length – the number of bytes to read
Returns:a reference to this, so the API can be used fluently
Deprecated:use rxRead instead
/** * Reads <code>length</code> bytes of data from the file at position <code>position</code> in the file, asynchronously. * <p> * The read data will be written into the specified <code>Buffer buffer</code> at position <code>offset</code>. * <p> * If data is read past the end of the file then zero bytes will be read.<p> * When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur. * <p> * The handler will be called when the close is complete, or if an error occurs. * @param buffer the buffer to read into * @param offset the offset into the buffer where the data will be read * @param position the position in the file where to start reading * @param length the number of bytes to read * @return a reference to this, so the API can be used fluently * @deprecated use {@link #rxRead} instead */
@Deprecated() public Observable<io.vertx.rxjava.core.buffer.Buffer> readObservable(io.vertx.rxjava.core.buffer.Buffer buffer, int offset, long position, int length) { io.vertx.rx.java.ObservableFuture<io.vertx.rxjava.core.buffer.Buffer> handler = io.vertx.rx.java.RxHelper.observableFuture(); read(buffer, offset, position, length, handler.toHandler()); return handler; }
Reads length bytes of data from the file at position position in the file, asynchronously.

The read data will be written into the specified Buffer buffer at position offset.

If data is read past the end of the file then zero bytes will be read.

When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur.

The handler will be called when the close is complete, or if an error occurs.

Params:
  • buffer – the buffer to read into
  • offset – the offset into the buffer where the data will be read
  • position – the position in the file where to start reading
  • length – the number of bytes to read
Returns:a reference to this, so the API can be used fluently
/** * Reads <code>length</code> bytes of data from the file at position <code>position</code> in the file, asynchronously. * <p> * The read data will be written into the specified <code>Buffer buffer</code> at position <code>offset</code>. * <p> * If data is read past the end of the file then zero bytes will be read.<p> * When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur. * <p> * The handler will be called when the close is complete, or if an error occurs. * @param buffer the buffer to read into * @param offset the offset into the buffer where the data will be read * @param position the position in the file where to start reading * @param length the number of bytes to read * @return a reference to this, so the API can be used fluently */
public Single<io.vertx.rxjava.core.buffer.Buffer> rxRead(io.vertx.rxjava.core.buffer.Buffer buffer, int offset, long position, int length) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { read(buffer, offset, position, length, fut); })); }
Flush any writes made to this file to underlying persistent storage.

If the file was opened with flush set to true then calling this method will have no effect.

The actual flush will happen asynchronously.

Returns:a reference to this, so the API can be used fluently
/** * Flush any writes made to this file to underlying persistent storage. * <p> * If the file was opened with <code>flush</code> set to <code>true</code> then calling this method will have no effect. * <p> * The actual flush will happen asynchronously. * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile flush() { delegate.flush(); return this; }
Same as flush but the handler will be called when the flush is complete or if an error occurs
Params:
  • handler –
Returns:
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#flush} but the handler will be called when the flush is complete or if an error occurs * @param handler * @return */
public io.vertx.rxjava.core.file.AsyncFile flush(Handler<AsyncResult<Void>> handler) { delegate.flush(handler); return this; }
Same as flush but the handler will be called when the flush is complete or if an error occurs
Returns:
Deprecated:use rxFlush instead
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#flush} but the handler will be called when the flush is complete or if an error occurs * @return * @deprecated use {@link #rxFlush} instead */
@Deprecated() public Observable<Void> flushObservable() { io.vertx.rx.java.ObservableFuture<Void> handler = io.vertx.rx.java.RxHelper.observableFuture(); flush(handler.toHandler()); return handler; }
Same as flush but the handler will be called when the flush is complete or if an error occurs
Returns:
/** * Same as {@link io.vertx.rxjava.core.file.AsyncFile#flush} but the handler will be called when the flush is complete or if an error occurs * @return */
public Single<Void> rxFlush() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { flush(fut); })); }
Sets the position from which data will be read from when using the file as a ReadStream.
Params:
  • readPos – the position in the file
Returns:a reference to this, so the API can be used fluently
/** * Sets the position from which data will be read from when using the file as a {@link io.vertx.rxjava.core.streams.ReadStream}. * @param readPos the position in the file * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile setReadPos(long readPos) { delegate.setReadPos(readPos); return this; }
Sets the position from which data will be written when using the file as a WriteStream.
Params:
  • writePos – the position in the file
Returns:a reference to this, so the API can be used fluently
/** * Sets the position from which data will be written when using the file as a {@link io.vertx.rxjava.core.streams.WriteStream}. * @param writePos the position in the file * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile setWritePos(long writePos) { delegate.setWritePos(writePos); return this; }
Returns:the current write position the file is at
/** * @return the current write position the file is at */
public long getWritePos() { long ret = delegate.getWritePos(); return ret; }
Sets the buffer size that will be used to read the data from the file. Changing this value will impact how much the data will be read at a time from the file system.
Params:
  • readBufferSize – the buffer size
Returns:a reference to this, so the API can be used fluently
/** * Sets the buffer size that will be used to read the data from the file. Changing this value will impact how much * the data will be read at a time from the file system. * @param readBufferSize the buffer size * @return a reference to this, so the API can be used fluently */
public io.vertx.rxjava.core.file.AsyncFile setReadBufferSize(int readBufferSize) { delegate.setReadBufferSize(readBufferSize); return this; } public static AsyncFile newInstance(io.vertx.core.file.AsyncFile arg) { return arg != null ? new AsyncFile(arg) : null; } }