vertx-lang-scala-docs_2.12 3.9.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package file
  Definition Classes
    core
- AsyncFile
- CopyOptions
- FileProps
- FileSystem
- FileSystemOptions
- FileSystemProps
- OpenOptions

c

io.vertx.scala.core.file

# AsyncFile 

###
Companion object AsyncFile

#### 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

Linear Supertypes
WriteStream[Buffer], ReadStream[Buffer], StreamBase, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. AsyncFile
2. WriteStream
3. ReadStream
4. StreamBase
5. AnyRef
6. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new AsyncFile(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
   Definition Classes
     AsyncFile → WriteStream → ReadStream → StreamBase
6.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
7.  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

8.  def close(): Unit

   Close the file.

   Close the file. The actual close happens asynchronously.

9.  def closeFuture(): scala.concurrent.Future[Unit]

   Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

10.  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
11.  def end(handler: Handler[AsyncResult[Unit]]): 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
12.  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
13.  def end(data: Buffer, handler: Handler[AsyncResult[Unit]]): Unit

    Same as but with an `handler` called when the operation completes

    Same as but with an `handler` called when the operation completes

    Definition Classes
      AsyncFile → WriteStream
14.  def end(data: 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. * @param data the data to write

    Definition Classes
      AsyncFile → WriteStream
15.  def endFuture(): scala.concurrent.Future[Unit]

    Like end but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Like end but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Definition Classes
      AsyncFile → WriteStream
16.  def endFuture(data: Buffer): scala.concurrent.Future[Unit]

    Like end but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Like end but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Definition Classes
      AsyncFile → WriteStream
17.  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
18.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
19.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
20.  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
21.  def fetch(amount: Long): AsyncFile

    Fetch the specified `amount` of elements.

    Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand. * @return a reference to this, so the API can be used fluently

    Definition Classes
      AsyncFile → ReadStream
22.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
23.  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

24.  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 `flush` set to `true` then 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

25.  def flushFuture(): scala.concurrent.Future[Unit]

    Like flush but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

26.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
27.  def getWritePos(): Long

    returns

      the current write position the file is at

28.  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
29.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
30.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
31.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
32.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
33.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
34.  def pause(): AsyncFile

    Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

    Pause the `ReadStream`, it sets the buffer in `fetch` mode 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
35.  def pipe(): Pipe[Buffer]

    Pause this stream and return a to transfer the elements of this stream to a destination .

    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`. * @return a pipe

    Definition Classes
      AsyncFile → ReadStream
36.  def pipeTo(dst: WriteStream[Buffer], handler: Handler[AsyncResult[Unit]]): Unit

    Pipe this `ReadStream` to the `WriteStream`.

    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. * @param dst the destination write stream

    Definition Classes
      AsyncFile → ReadStream
37.  def pipeTo(dst: WriteStream[Buffer]): Unit

    Like io.vertx.scala.core.streams.ReadStream#pipeTo but with no completion handler.

    Like io.vertx.scala.core.streams.ReadStream#pipeTo but with no completion handler.

    Definition Classes
      AsyncFile → ReadStream
38.  def pipeToFuture(dst: WriteStream[Buffer]): scala.concurrent.Future[Unit]

    Like pipeTo but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Like pipeTo but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Definition Classes
      AsyncFile → ReadStream
39.  def read(buffer: Buffer, offset: Int, position: Long, length: Int, handler: Handler[AsyncResult[Buffer]]): AsyncFile

    Reads `length` bytes of data from the file at position `position` in the file, asynchronously.

    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. * @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

40.  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.

41.  def resume(): AsyncFile

    Resume reading, and sets the buffer in `flowing` mode.

    Resume reading, and sets the buffer in `flowing` mode.

    If the `ReadStream` has been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently

    Definition Classes
      AsyncFile → ReadStream
42.  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

43.  def setReadLength(readLength: Long): AsyncFile

    Sets the number of bytes that will be read when using the file as a io.vertx.scala.core.streams.ReadStream.

    Sets the number of bytes that will be read when using the file as a io.vertx.scala.core.streams.ReadStream. * @param readLength the bytes that will be read from the file

    returns

      a reference to this, so the API can be used fluently

44.  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

45.  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

46.  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 than `maxSize` items in the write queue. This is used as an indicator by classes such as `Pump` to 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
47.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
48.  def toString(): String
    Definition Classes
      AnyRef → Any
49.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
50.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
51.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )
52.  def write(buffer: Buffer, position: Long, handler: Handler[AsyncResult[Unit]]): AsyncFile

    Write a io.vertx.scala.core.buffer.Buffer to the file at position `position` in the file, asynchronously.

    Write a io.vertx.scala.core.buffer.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. * @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

53.  def write(data: Buffer, handler: Handler[AsyncResult[Unit]]): AsyncFile

    Same as io.vertx.scala.core.file.AsyncFile#write but with an `handler` called when the operation completes

    Same as io.vertx.scala.core.file.AsyncFile#write but with an `handler` called when the operation completes

    Definition Classes
      AsyncFile → WriteStream
54.  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
55.  def writeFuture(buffer: Buffer, position: Long): scala.concurrent.Future[Unit]

    Like write but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

56.  def writeFuture(data: Buffer): scala.concurrent.Future[Unit]

    Like write but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Like write but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Definition Classes
      AsyncFile → WriteStream
57.  def writeQueueFull(): Boolean

    This will return `true` if 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

    This will return `true` if 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

### Inherited from WriteStream[Buffer]

### Inherited from ReadStream[Buffer]

### Inherited from StreamBase

### Inherited from AnyRef

### Inherited from Any

### Ungrouped