/** * 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 <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); })); }
/** * 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); })); }