Class BufferedIoOutputStream

    • Field Detail

      • id

        protected final java.lang.Object id
      • channelId

        protected final int channelId
      • maxPendingBytesCount

        protected final int maxPendingBytesCount
      • maxWaitForPendingWrites

        protected final java.time.Duration maxWaitForPendingWrites
      • pendingBytesCount

        protected final java.util.concurrent.atomic.AtomicInteger pendingBytesCount
      • writtenBytesCount

        protected final java.util.concurrent.atomic.AtomicLong writtenBytesCount
      • currentWrite

        protected final java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> currentWrite
    • Constructor Detail

      • BufferedIoOutputStream

        public BufferedIoOutputStream​(java.lang.Object id,
                                      int channelId,
                                      IoOutputStream out,
                                      int maxPendingBytesCount,
                                      java.time.Duration maxWaitForPendingWrites)
    • Method Detail

      • getId

        public java.lang.Object getId()
      • writeBuffer

        public IoWriteFuture writeBuffer​(Buffer buffer)
                                  throws java.io.IOException
        Description copied from interface: IoOutputStream
        Write the given buffer.
        Specified by:
        writeBuffer in interface IoOutputStream
        Parameters:
        buffer - the data to write. NOTE: the buffer must not be touched until the returned write future is completed.
        Returns:
        An IoWriteFuture that can be used to check when the data has actually been written.
        Throws:
        java.io.IOException - if an error occurred when writing the data
      • waitForAvailableWriteSpace

        protected void waitForAvailableWriteSpace​(int requiredSize)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • startWriting

        protected void startWriting()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • finishWrite

        protected void finishWrite​(IoWriteFutureImpl future,
                                   int bufferSize)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object