Top Description Fields Constructors Methods
io.vertx.core.file.impl

public Class AsyncFileImpl

extends Object
implements AsyncFile
Class Inheritance
All Implemented Interfaces
io.vertx.core.file.AsyncFile, io.vertx.core.streams.WriteStream, io.vertx.core.streams.StreamBase, io.vertx.core.streams.ReadStream
Imports
io.netty.buffer.ByteBuf, io.vertx.core.AsyncResult, .Future, .Handler, .Promise, io.vertx.core.buffer.Buffer, io.vertx.core.file.AsyncFile, .AsyncFileLock, .FileSystemException, .OpenOptions, io.vertx.core.impl.Arguments, .ContextInternal, .VertxInternal, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.impl.logging.Logger, .LoggerFactory, io.vertx.core.streams.impl.InboundBuffer, java.io.IOException, java.nio.ByteBuffer, java.nio.channels.AsynchronousFileChannel, .CompletionHandler, .FileLock, java.nio.file.OpenOption, .Path, .Paths, .StandardOpenOption, java.nio.file.attribute.FileAttribute, .PosixFilePermissions, java.util.HashSet, .Objects, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger

This class is optimised for performance when used on the same event loop that is was passed to the handler with. However it can be used safely from other threads. The internal state is protected using the synchronized keyword. If always used on the same event loop, then we benefit from biased locking which makes the overhead of synchronized near zero.
Author
Tim Fox

Field Summary

Modifier and TypeField and Description
private final AsynchronousFileChannel
private boolean
private Runnable
private final ContextInternal
public static final int
private Handler<Void>
private Handler<Void>
private Handler<Throwable>
private Handler<Buffer>
private static CompletionHandler<FileLock, PromiseInternal<AsyncFileLock>>
private static final Logger
private int
private int
private boolean
private InboundBuffer<Buffer>
private int
private long
private long
private final VertxInternal
private long
private long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
public Future<Void>
close()

Implements io.vertx.core.file.AsyncFile.close.

Close the file.

public void
close(Handler<AsyncResult<Void>>
the handler
handler
)

Implements io.vertx.core.file.AsyncFile.close.

Close the file.

private synchronized void
private void
private synchronized void
private void
private synchronized void
private void
doRead(Buffer writeBuff, int offset, ByteBuffer buff, long position, Promise<Buffer> promise)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

private synchronized void
doWrite(Buffer buffer, long position, Handler<AsyncResult<Void>> handler)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

private synchronized void
doWrite(ByteBuffer[] buffers, long position, Handler<AsyncResult<Void>> handler)

private void
doWrite(ByteBuffer buff, long position, long toWrite, Handler<AsyncResult<Void>> handler)

public synchronized AsyncFile
public Future<Void>
end()

Overrides default io.vertx.core.streams.WriteStream.end.

Ends the stream.

public void
end(Handler<AsyncResult<Void>> handler)

Overrides default io.vertx.core.streams.WriteStream.end.

Implements io.vertx.core.streams.WriteStream.end.

Same as end() but with an handler called when the operation completes

public synchronized AsyncFile
public synchronized AsyncFile
public AsyncFile
fetch(long amount)

Implements io.vertx.core.file.AsyncFile.fetch.

Fetch the specified amount of elements.

public Future<Void>
flush()

Implements io.vertx.core.file.AsyncFile.flush.

Flush any writes made to this file to underlying persistent storage.

public AsyncFile
flush(Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.file.AsyncFile.flush.

Same as flush but the handler will be called when the flush is complete or if an error occurs

public synchronized long
public synchronized long
private void
handleBuffer(Buffer buff)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

private void
private void
public synchronized AsyncFile
public Future<AsyncFileLock>
lock()

Implements io.vertx.core.file.AsyncFile.lock.

Acquire a non-shared lock on the entire file.

public void
lock(Handler<AsyncResult<AsyncFileLock>> handler)

Implements io.vertx.core.file.AsyncFile.lock.

Like lock() but the handler will be called when the operation is complete or if an error occurs.

public Future<AsyncFileLock>
lock(long
where the region starts
position
,
long
the size of the region
size
,
boolean
whether the lock should be shared
shared
)

Implements io.vertx.core.file.AsyncFile.lock.

Acquire a lock on a portion of this file.

public void
lock(long position, long size, boolean shared, Handler<AsyncResult<AsyncFileLock>> handler)

Implements io.vertx.core.file.AsyncFile.lock.

Like lock(long, long, boolean) but the handler will be called when the operation is complete or if an error occurs.

public synchronized AsyncFile
pause()

Implements io.vertx.core.file.AsyncFile.pause.

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

public synchronized AsyncFile
read(Buffer
the buffer to read into
buffer
,
int
the offset into the buffer where the data will be read
offset
,
long
the position in the file where to start reading
position
,
int
the number of bytes to read
length
,
Handler<AsyncResult<Buffer>>
the handler to call when the write is complete
handler
)

Implements io.vertx.core.file.AsyncFile.read.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

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

public Future<Buffer>
read(Buffer buffer, int offset, long position, int length)

Implements io.vertx.core.file.AsyncFile.read.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Like read(Buffer, int, long, int, Handler) but returns a Future of the asynchronous result

public synchronized AsyncFile
resume()

Implements io.vertx.core.file.AsyncFile.resume.

Resume reading, and sets the buffer in flowing mode.

public synchronized AsyncFile
setReadBufferSize(int
the buffer size
readBufferSize
)

Implements io.vertx.core.file.AsyncFile.setReadBufferSize.

Sets the buffer size that will be used to read the data from the file.

public synchronized AsyncFile
setReadLength(long
the bytes that will be read from the file
readLength
)

Implements io.vertx.core.file.AsyncFile.setReadLength.

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

public synchronized AsyncFile
setReadPos(long
the position in the file
readPos
)

Implements io.vertx.core.file.AsyncFile.setReadPos.

Sets the position from which data will be read from when using the file as a io.vertx.core.streams.ReadStream.

public synchronized AsyncFile
setWritePos(long
the position in the file
writePos
)

Implements io.vertx.core.file.AsyncFile.setWritePos.

Sets the position from which data will be written when using the file as a io.vertx.core.streams.WriteStream.

public synchronized AsyncFile
setWriteQueueMaxSize(int
the max size of the write stream
maxSize
)

Implements io.vertx.core.file.AsyncFile.setWriteQueueMaxSize.

Set the maximum size of the write queue to maxSize.

public Future<Long>
public long
public AsyncFileLock
tryLock()

Implements io.vertx.core.file.AsyncFile.tryLock.

Try to acquire a non-shared lock on the entire file.

public AsyncFileLock
tryLock(long
where the region starts
position
,
long
the size of the region
size
,
boolean
whether the lock should be shared
shared
)

Implements io.vertx.core.file.AsyncFile.tryLock.

Try to acquire a lock on a portion of this file.

public void
write(Buffer
the buffer to write
buffer
,
long
the position in the file to write it at
position
,
Handler<AsyncResult<Void>>
the handler to call when the write is complete
handler
)

Implements io.vertx.core.file.AsyncFile.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

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

public Future<Void>
write(Buffer buffer, long position)

Implements io.vertx.core.file.AsyncFile.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Like write(Buffer, long, Handler) but returns a Future of the asynchronous result

public Future<Void>
write(Buffer
the data to write
buffer
)

Implements io.vertx.core.streams.WriteStream.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Write some data to the stream.

public synchronized void
write(Buffer buffer, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.streams.WriteStream.write.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as write(T) but with an handler called when the operation completes

private void
writeInternal(ByteBuffer buff, long position, Handler<AsyncResult<Void>> handler)

public synchronized boolean
writeQueueFull()

Implements io.vertx.core.streams.WriteStream.writeQueueFull.

This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chback to summary
private final AsynchronousFileChannel ch
closedback to summary
private boolean closed
closedDeferredback to summary
private Runnable closedDeferred
contextback to summary
private final ContextInternal context
DEFAULT_READ_BUFFER_SIZEback to summary
public static final int DEFAULT_READ_BUFFER_SIZE
drainHandlerback to summary
private Handler<Void> drainHandler
endHandlerback to summary
private Handler<Void> endHandler
exceptionHandlerback to summary
private Handler<Throwable> exceptionHandler
handlerback to summary
private Handler<Buffer> handler
LOCK_COMPLETIONback to summary
private static CompletionHandler<FileLock, PromiseInternal<AsyncFileLock>> LOCK_COMPLETION
logback to summary
private static final Logger log
lwmback to summary
private int lwm
maxWritesback to summary
private int maxWrites
overflowback to summary
private boolean overflow
queueback to summary
private InboundBuffer<Buffer> queue
readBufferSizeback to summary
private int readBufferSize
readLengthback to summary
private long readLength
readPosback to summary
private long readPos
vertxback to summary
private final VertxInternal vertx
writePosback to summary
private long writePos
writesOutstandingback to summary
private long writesOutstanding

Constructor Detail

AsyncFileImplback to summary
pack-priv AsyncFileImpl(VertxInternal vertx, String path, OpenOptions options, ContextInternal context)

Method Detail

checkback to summary
private void check()
checkClosedback to summary
private void checkClosed()
checkContextback to summary
private void checkContext()
closeback to summary
public Future<Void> close()

Implements io.vertx.core.file.AsyncFile.close.

Doc from io.vertx.core.file.AsyncFile.close.

Close the file. The actual close happens asynchronously.

Returns:Future<Void>

a future completed with the result

Annotations
@Override
closeback to summary
public void close(Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.file.AsyncFile.close.

Doc from io.vertx.core.file.AsyncFile.close.

Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs.

Parameters
handler:Handler<AsyncResult<Void>>

the handler

Annotations
@Override
closeInternalback to summary
private synchronized void closeInternal(Handler<AsyncResult<Void>> handler)
doCloseback to summary
private void doClose(Handler<AsyncResult<Void>> handler)
doFlushback to summary
private synchronized void doFlush(Handler<AsyncResult<Void>> handler)
doReadback to summary
private void doRead()
doReadback to summary
private synchronized void doRead(ByteBuffer bb)
doReadback to summary
private void doRead(Buffer writeBuff, int offset, ByteBuffer buff, long position, Promise<Buffer> promise)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

doWriteback to summary
private synchronized void doWrite(Buffer buffer, long position, Handler<AsyncResult<Void>> handler)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

doWriteback to summary
private synchronized void doWrite(ByteBuffer[] buffers, long position, Handler<AsyncResult<Void>> handler)
doWriteback to summary
private void doWrite(ByteBuffer buff, long position, long toWrite, Handler<AsyncResult<Void>> handler)
drainHandlerback to summary
public synchronized AsyncFile drainHandler(Handler<Void> handler)

Implements io.vertx.core.file.AsyncFile.drainHandler.

Annotations
@Override
endback to summary
public Future<Void> end()

Overrides default io.vertx.core.streams.WriteStream.end.

Doc from io.vertx.core.streams.WriteStream.end.

Ends the stream.

Once the stream has ended, it cannot be used any more.

Returns:Future<Void>

a future completed with the result

Annotations
@Override
endback to summary
public void end(Handler<AsyncResult<Void>> handler)

Overrides default io.vertx.core.streams.WriteStream.end.

Implements io.vertx.core.streams.WriteStream.end.

Doc from io.vertx.core.streams.WriteStream.end.

Same as end() but with an handler called when the operation completes

Annotations
@Override
endHandlerback to summary
public synchronized AsyncFile endHandler(Handler<Void> handler)

Implements io.vertx.core.file.AsyncFile.endHandler.

Annotations
@Override
exceptionHandlerback to summary
public synchronized AsyncFile exceptionHandler(Handler<Throwable> handler)

Implements io.vertx.core.file.AsyncFile.exceptionHandler.

Annotations
@Override
fetchback to summary
public AsyncFile fetch(long amount)

Implements io.vertx.core.file.AsyncFile.fetch.

Doc from io.vertx.core.streams.ReadStream.fetch.

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.

Returns:AsyncFile

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

Annotations
@Override
flushback to summary
public Future<Void> flush()

Implements io.vertx.core.file.AsyncFile.flush.

Doc from io.vertx.core.file.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.

Returns:Future<Void>

a future completed with the result

Annotations
@Override
flushback to summary
public AsyncFile flush(Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.file.AsyncFile.flush.

Doc from io.vertx.core.file.AsyncFile.flush.

Same as flush but the handler will be called when the flush is complete or if an error occurs

Annotations
@Override
getReadLengthback to summary
public synchronized long getReadLength()

Implements io.vertx.core.file.AsyncFile.getReadLength.

Returns:long

Doc from io.vertx.core.file.AsyncFile.getReadLength.

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

Annotations
@Override
getWritePosback to summary
public synchronized long getWritePos()

Implements io.vertx.core.file.AsyncFile.getWritePos.

Returns:long

Doc from io.vertx.core.file.AsyncFile.getWritePos.

the current write position the file is at

Annotations
@Override
handleBufferback to summary
private void handleBuffer(Buffer buff)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

handleEndback to summary
private void handleEnd()
handleExceptionback to summary
private void handleException(Throwable t)
handlerback to summary
public synchronized AsyncFile handler(Handler<Buffer> handler)

Implements io.vertx.core.file.AsyncFile.handler.

Annotations
@Override
lockback to summary
public Future<AsyncFileLock> lock()

Implements io.vertx.core.file.AsyncFile.lock.

Doc from io.vertx.core.file.AsyncFile.lock.

Acquire a non-shared lock on the entire file.

Returns:Future<AsyncFileLock>

a future indicating the completion of this operation

Annotations
@Override
lockback to summary
public void lock(Handler<AsyncResult<AsyncFileLock>> handler)

Implements io.vertx.core.file.AsyncFile.lock.

Doc from io.vertx.core.file.AsyncFile.lock.

Like lock() but the handler will be called when the operation is complete or if an error occurs.

Annotations
@Override
lockback to summary
public Future<AsyncFileLock> lock(long position, long size, boolean shared)

Implements io.vertx.core.file.AsyncFile.lock.

Doc from io.vertx.core.file.AsyncFile.lock.

Acquire a lock on a portion of this file.

Parameters
position:long

where the region starts

size:long

the size of the region

shared:boolean

whether the lock should be shared

Returns:Future<AsyncFileLock>

a future indicating the completion of this operation

Annotations
@Override
lockback to summary
public void lock(long position, long size, boolean shared, Handler<AsyncResult<AsyncFileLock>> handler)

Implements io.vertx.core.file.AsyncFile.lock.

Doc from io.vertx.core.file.AsyncFile.lock.

Like lock(long, long, boolean) but the handler will be called when the operation is complete or if an error occurs.

Annotations
@Override
pauseback to summary
public synchronized AsyncFile pause()

Implements io.vertx.core.file.AsyncFile.pause.

Doc from io.vertx.core.streams.ReadStream.pause.

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.

Returns:AsyncFile

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

Annotations
@Override
readback to summary
public synchronized AsyncFile read(Buffer buffer, int offset, long position, int length, Handler<AsyncResult<Buffer>> handler)

Implements io.vertx.core.file.AsyncFile.read.

Doc from io.vertx.core.file.AsyncFile.read.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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:Buffer

the buffer to read into

offset:int

the offset into the buffer where the data will be read

position:long

the position in the file where to start reading

length:int

the number of bytes to read

handler:Handler<AsyncResult<Buffer>>

the handler to call when the write is complete

Returns:AsyncFile

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

Annotations
@Override
readback to summary
public Future<Buffer> read(Buffer buffer, int offset, long position, int length)

Implements io.vertx.core.file.AsyncFile.read.

Doc from io.vertx.core.file.AsyncFile.read.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Like read(Buffer, int, long, int, Handler) but returns a Future of the asynchronous result

Annotations
@Override
resumeback to summary
public synchronized AsyncFile resume()

Implements io.vertx.core.file.AsyncFile.resume.

Doc from io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

If the ReadStream has been paused, reading will recommence on it.

Returns:AsyncFile

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

Annotations
@Override
setReadBufferSizeback to summary
public synchronized AsyncFile setReadBufferSize(int readBufferSize)

Implements io.vertx.core.file.AsyncFile.setReadBufferSize.

Doc from io.vertx.core.file.AsyncFile.setReadBufferSize.

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:int

the buffer size

Returns:AsyncFile

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

Annotations
@Override
setReadLengthback to summary
public synchronized AsyncFile setReadLength(long readLength)

Implements io.vertx.core.file.AsyncFile.setReadLength.

Doc from io.vertx.core.file.AsyncFile.setReadLength.

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

Parameters
readLength:long

the bytes that will be read from the file

Returns:AsyncFile

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

Annotations
@Override
setReadPosback to summary
public synchronized AsyncFile setReadPos(long readPos)

Implements io.vertx.core.file.AsyncFile.setReadPos.

Doc from io.vertx.core.file.AsyncFile.setReadPos.

Sets the position from which data will be read from when using the file as a io.vertx.core.streams.ReadStream.

Parameters
readPos:long

the position in the file

Returns:AsyncFile

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

Annotations
@Override
setWritePosback to summary
public synchronized AsyncFile setWritePos(long writePos)

Implements io.vertx.core.file.AsyncFile.setWritePos.

Doc from io.vertx.core.file.AsyncFile.setWritePos.

Sets the position from which data will be written when using the file as a io.vertx.core.streams.WriteStream.

Parameters
writePos:long

the position in the file

Returns:AsyncFile

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

Annotations
@Override
setWriteQueueMaxSizeback to summary
public synchronized AsyncFile setWriteQueueMaxSize(int maxSize)

Implements io.vertx.core.file.AsyncFile.setWriteQueueMaxSize.

Doc from io.vertx.core.streams.WriteStream.setWriteQueueMaxSize.

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 Pipe to provide flow control.

The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.core.net.NetSocket, etc...

Parameters
maxSize:int

the max size of the write stream

Returns:AsyncFile

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

Annotations
@Override
sizeback to summary
public Future<Long> size()

Implements io.vertx.core.file.AsyncFile.size.

Returns:Future<Long>

Doc from io.vertx.core.file.AsyncFile.size.

the size of the file

Annotations
@Override
sizeBlockingback to summary
public long sizeBlocking()

Implements io.vertx.core.file.AsyncFile.sizeBlocking.

Doc from io.vertx.core.file.AsyncFile.sizeBlocking.

Like size() but blocking.

Annotations
@Override
tryLockback to summary
public AsyncFileLock tryLock()

Implements io.vertx.core.file.AsyncFile.tryLock.

Doc from io.vertx.core.file.AsyncFile.tryLock.

Try to acquire a non-shared lock on the entire file.

Returns:AsyncFileLock

the lock if it can be acquired immediately, otherwise null

Annotations
@Override
tryLockback to summary
public AsyncFileLock tryLock(long position, long size, boolean shared)

Implements io.vertx.core.file.AsyncFile.tryLock.

Doc from io.vertx.core.file.AsyncFile.tryLock.

Try to acquire a lock on a portion of this file.

Parameters
position:long

where the region starts

size:long

the size of the region

shared:boolean

whether the lock should be shared

Returns:AsyncFileLock

the lock if it can be acquired immediately, otherwise null

Annotations
@Override
writeback to summary
public void write(Buffer buffer, long position, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.file.AsyncFile.write.

Doc from io.vertx.core.file.AsyncFile.write.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Write a io.vertx.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.

Parameters
buffer:Buffer

the buffer to write

position:long

the position in the file to write it at

handler:Handler<AsyncResult<Void>>

the handler to call when the write is complete

Annotations
@Override
writeback to summary
public Future<Void> write(Buffer buffer, long position)

Implements io.vertx.core.file.AsyncFile.write.

Doc from io.vertx.core.file.AsyncFile.write.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Like write(Buffer, long, Handler) but returns a Future of the asynchronous result

Annotations
@Override
writeback to summary
public Future<Void> write(Buffer buffer)

Implements io.vertx.core.streams.WriteStream.write.

Doc from io.vertx.core.streams.WriteStream.write.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Write some data to the stream.

The data is usually 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 Pipe.

When the data is moved from the queue to the actual medium, the returned Future will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.

Parameters
buffer:Buffer

the data to write

Returns:Future<Void>

a future completed with the write result

Annotations
@Override
writeback to summary
public synchronized void write(Buffer buffer, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.streams.WriteStream.write.

Doc from io.vertx.core.streams.WriteStream.write.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Same as write(T) but with an handler called when the operation completes

Annotations
@Override
writeInternalback to summary
private void writeInternal(ByteBuffer buff, long position, Handler<AsyncResult<Void>> handler)
writeQueueFullback to summary
public synchronized boolean writeQueueFull()

Implements io.vertx.core.streams.WriteStream.writeQueueFull.

Doc from io.vertx.core.streams.WriteStream.writeQueueFull.

This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize

Returns:boolean

true if write queue is full

Annotations
@Override