class AsyncFile extends ReadStream[Buffer] with WriteStream[Buffer]
Represents a file on the file-system which can be read from, or written to asynchronously.
This class also implements io.vertx.scala.core.streams.ReadStream and io.vertx.scala.core.streams.WriteStream. This allows the data to be pumped to and from other streams, e.g. an io.vertx.scala.core.http.HttpClientRequest instance, using the io.vertx.scala.core.streams.Pump class
- Alphabetic
- By Inheritance
- AsyncFile
- WriteStream
- ReadStream
- StreamBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-  new AsyncFile(_asJava: AnyRef)
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        asJava: AnyRef
      
      
      - Definition Classes
- AsyncFile → WriteStream → ReadStream → StreamBase
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        close(handler: Handler[AsyncResult[Unit]]): Unit
      
      
      Close the file. 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 
- 
      
      
      
        
      
    
      
        
        def
      
      
        close(): Unit
      
      
      Close the file. Close the file. The actual close happens asynchronously. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        closeFuture(): scala.concurrent.Future[Unit]
      
      
      Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        drainHandler(handler: Handler[Unit]): AsyncFile
      
      
      Set a drain handler on the stream. Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See io.vertx.scala.core.streams.Pump for an example of this being used. The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to maxSize / 2. * @param handler the handler- returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- AsyncFile → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        end(): Unit
      
      
      Close the file, see io.vertx.scala.core.file.AsyncFile#close. Close the file, see io.vertx.scala.core.file.AsyncFile#close. - Definition Classes
- AsyncFile → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        end(t: Buffer): Unit
      
      
      Same as io.vertx.scala.core.file.AsyncFile#end but writes some data to the stream before ending. Same as io.vertx.scala.core.file.AsyncFile#end but writes some data to the stream before ending. - Definition Classes
- AsyncFile → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        endHandler(endHandler: Handler[Unit]): AsyncFile
      
      
      Set an end handler. Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. * @return a reference to this, so the API can be used fluently - Definition Classes
- AsyncFile → ReadStream
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        exceptionHandler(handler: Handler[Throwable]): AsyncFile
      
      
      Set an exception handler on the write stream. Set an exception handler on the write stream. * @param handler the exception handler - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- AsyncFile → WriteStream → ReadStream → StreamBase
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        fetch(amount: Long): AsyncFile
      
      
      Fetch the specified amountof elements.Fetch the specified amountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand. * @return a reference to this, so the API can be used fluently- Definition Classes
- AsyncFile → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        flush(handler: Handler[AsyncResult[Unit]]): AsyncFile
      
      
      Same as io.vertx.scala.core.file.AsyncFile#flush but the handler will be called when the flush is complete or if an error occurs 
- 
      
      
      
        
      
    
      
        
        def
      
      
        flush(): AsyncFile
      
      
      Flush any writes made to this file to underlying persistent storage. Flush any writes made to this file to underlying persistent storage. If the file was opened with flushset totruethen calling this method will have no effect.The actual flush will happen asynchronously. * @return a reference to this, so the API can be used fluently 
- 
      
      
      
        
      
    
      
        
        def
      
      
        flushFuture(): scala.concurrent.Future[Unit]
      
      
      Like flush but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        handler(handler: Handler[Buffer]): AsyncFile
      
      
      Set a data handler. Set a data handler. As data is read, the handler will be called with the data. * @return a reference to this, so the API can be used fluently - Definition Classes
- AsyncFile → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        pause(): AsyncFile
      
      
      Pause the ReadStream, it sets the buffer infetchmode and clears the actual demand.Pause the ReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data handler. * @return a reference to this, so the API can be used fluently- Definition Classes
- AsyncFile → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        read(buffer: Buffer, offset: Int, position: Long, length: Int, handler: Handler[AsyncResult[Buffer]]): AsyncFile
      
      
      Reads lengthbytes of data from the file at positionpositionin the file, asynchronously.Reads lengthbytes of data from the file at positionpositionin the file, asynchronously.The read data will be written into the specified Buffer bufferat positionoffset.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. * @param 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 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        readFuture(buffer: Buffer, offset: Int, position: Long, length: Int): scala.concurrent.Future[Buffer]
      
      
      Like read but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        resume(): AsyncFile
      
      
      Resume reading, and sets the buffer in flowingmode.Resume reading, and sets the buffer in flowingmode.If the ReadStreamhas been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently- Definition Classes
- AsyncFile → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        setReadBufferSize(readBufferSize: Int): AsyncFile
      
      
      Sets the buffer size that will be used to read the data from the file. 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 - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        setReadPos(readPos: Long): AsyncFile
      
      
      Sets the position from which data will be read from when using the file as a io.vertx.scala.core.streams.ReadStream. Sets the position from which data will be read from when using the file as a io.vertx.scala.core.streams.ReadStream. * @param readPos the position in the file - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        setWritePos(writePos: Long): AsyncFile
      
      
      Sets the position from which data will be written when using the file as a io.vertx.scala.core.streams.WriteStream. Sets the position from which data will be written when using the file as a io.vertx.scala.core.streams.WriteStream. * @param writePos the position in the file - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        setWriteQueueMaxSize(maxSize: Int): AsyncFile
      
      
      Set the maximum size of the write queue to maxSize.Set the maximum size of the write queue to maxSize. You will still be able to write to the stream even if there is more thanmaxSizeitems in the write queue. This is used as an indicator by classes such asPumpto provide flow control.The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.scala.core.net.NetSocket, the number of io.vertx.scala.core.eventbus.Message for a io.vertx.scala.core.eventbus.MessageProducer, etc... * @param maxSize the max size of the write stream - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- AsyncFile → WriteStream
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(buffer: Buffer, position: Long, handler: Handler[AsyncResult[Unit]]): AsyncFile
      
      
      Write a io.vertx.scala.core.buffer.Buffer to the file at position positionin the file, asynchronously.Write a io.vertx.scala.core.buffer.Buffer to the file at position positionin the file, asynchronously.If positionlies 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. * @param 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 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(data: Buffer): AsyncFile
      
      
      Write some data to the stream. Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the io.vertx.scala.core.streams.WriteStream#writeQueueFull method before writing. This is done automatically if using a io.vertx.scala.core.streams.Pump. * @param data the data to write - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- AsyncFile → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        writeFuture(buffer: Buffer, position: Long): scala.concurrent.Future[Unit]
      
      
      Like write but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        writeQueueFull(): Boolean
      
      
      This will return trueif there are more bytes in the write queue than the value set using io.vertx.scala.core.file.AsyncFile#setWriteQueueMaxSize * @return true if write queue is fullThis will return trueif there are more bytes in the write queue than the value set using io.vertx.scala.core.file.AsyncFile#setWriteQueueMaxSize * @return true if write queue is full- Definition Classes
- AsyncFile → WriteStream