|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vertx.groovy.core.file.AsyncFile
class AsyncFile
Represents a file on the file-system which can be read from, or written to asynchronously.
Methods also exist to get a ReadStream or a org.vertx.java.core.streams.WriteStream on the file. This allows the data to be pumped to and from other streams, e.g. an HttpClientRequest instance, using the Pump class
Instances of this class are not thread-safe
Constructor Summary | |
AsyncFile(JAsyncFile jFile)
|
Method Summary | |
---|---|
void
|
close()
Close the file. |
void
|
close(groovy.lang.Closure handler)
Close the file. |
void
|
flush()
Flush any writes made to this file to underlying persistent storage. |
void
|
flush(groovy.lang.Closure handler)
Same as flush but the handler will be called when the flush is complete or an error occurs |
ReadStream
|
getReadStream()
Return a ReadStream instance operating on this AsyncFile. |
WriteStream
|
getWriteStream()
Return a WriteStream instance operating on this AsyncFile. |
void
|
read(Buffer buffer, int offset, int position, int length, groovy.lang.Closure handler)
Reads length bytes of data from the file at position position in the file, asynchronously. |
void
|
write(Buffer buffer, int position, groovy.lang.Closure handler)
Write a Buffer to the file at position position in the file, asynchronously. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
AsyncFile(JAsyncFile jFile)
Method Detail |
---|
void close()
void close(groovy.lang.Closure handler)
void flush()
If the file was opened with flush set to true then calling this method will have no effect.
The actual flush will happen asynchronously.
void flush(groovy.lang.Closure handler)
ReadStream getReadStream()
WriteStream getWriteStream()
void read(Buffer buffer, int offset, int position, int length, groovy.lang.Closure handler)
The index position + length must lie within the confines of the file.
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.
void write(Buffer buffer, int position, groovy.lang.Closure handler)
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 close is complete, or an error occurs.
Groovy Documentation