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

- `Anything`
  - `Object`
    - `Basic` ...and other supertypes
      - `AsyncFile` ...and other supertypes

- `AsyncFile`
  - `Basic`
    - `Identifiable`
    - `Object`
      - `Anything`
  - `ReadStream`
    - `StreamBase`
  - `WriteStream`
    - `StreamBase`

no subtypes hierarchy

Initializer
`AsyncFile(AsyncFile unknown)`

Inherited Attributes
Attributes inherited from: `Object` `hash`, `string`

Methods
`close` | `shared default void close()` Close the file. The actual close happens asynchronously.
`close` | `shared default void close(Anything(Throwable?) handler)` Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs. Parameters: `handler` the handler
`drainHandler` | `shared actual default AsyncFile drainHandler(Anything()? handler)` 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 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`. Refines `WriteStream.drainHandler`
`end` | `shared actual default void end()` Close the file, see close. Refines `WriteStream.end`
`end` | `shared actual default void end(Buffer t)` Same as end but writes some data to the stream before ending. Refines `WriteStream.end`
`endHandler` | `shared actual default AsyncFile endHandler(Anything()? endHandler)` Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. Refines `ReadStream.endHandler`
`exceptionHandler` | `shared actual default AsyncFile exceptionHandler(Anything(Throwable)? handler)` Set an exception handler. Refines `StreamBase.exceptionHandler`
`flush` | `shared default AsyncFile flush()` 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.
`flush` | `shared default AsyncFile flush(Anything(Throwable?) handler)` Same as flush but the handler will be called when the flush is complete or if an error occurs
`handler` | `shared actual default AsyncFile handler(Anything(Buffer)? handler)` Set a data handler. As data is read, the handler will be called with the data. Refines `ReadStream.handler`
`pause` | `shared actual default AsyncFile pause()` Pause the `ReadSupport`. While it's paused, no data will be sent to the `dataHandler` Refines `ReadStream.pause`
`read` | `shared default AsyncFile read(Buffer buffer, Integer offset, Integer position, Integer length, Anything(Throwable|Buffer) 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. Parameters: `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
`resume` | `shared actual default AsyncFile resume()` Resume reading. If the `ReadSupport` has been paused, reading will recommence on it. Refines `ReadStream.resume`
`setReadBufferSize` | `shared default AsyncFile setReadBufferSize(Integer readBufferSize)` 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. Parameters: `readBufferSize` the buffer size
`setReadPos` | `shared default AsyncFile setReadPos(Integer readPos)` Sets the position from which data will be read from when using the file as a ReadStream. Parameters: `readPos` the position in the file
`setWritePos` | `shared default AsyncFile setWritePos(Integer writePos)` Sets the position from which data will be written when using the file as a WriteStream. Parameters: `writePos` the position in the file
`setWriteQueueMaxSize` | `shared actual default AsyncFile setWriteQueueMaxSize(Integer 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 NetSocket, the number of Message for a MessageProducer, etc… Refines `WriteStream.setWriteQueueMaxSize`
`write` | `shared actual default AsyncFile write(Buffer data)` 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 writeQueueFull method before writing. This is done automatically if using a Pump. Refines `WriteStream.write`
`write` | `shared default AsyncFile write(Buffer buffer, Integer position, Anything(Throwable?) 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. Parameters: `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
`writeQueueFull` | `shared actual default Boolean writeQueueFull()` This will return `true` if there are more bytes in the write queue than the value set using setWriteQueueMaxSize Refines `WriteStream.writeQueueFull`

Inherited Methods
Methods inherited from: `Object` `equals`
Methods inherited from: `ReadStream<T>` `endHandler()`, `exceptionHandler()`, `handler()`, `pause()`, `resume()`
Methods inherited from: `StreamBase` `exceptionHandler()`
Methods inherited from: `WriteStream<T>` `drainHandler()`, `end()`, `exceptionHandler()`, `setWriteQueueMaxSize()`, `write()`, `writeQueueFull()`