Class BufferedOutput

    • Field Detail

      • ZERO

        protected static final java.lang.Integer ZERO
      • ZERO_READY_FUTURE

        protected static final GrizzlyFuture<java.lang.Integer> ZERO_READY_FUTURE
      • bufferSize

        protected final int bufferSize
      • isClosed

        protected final java.util.concurrent.atomic.AtomicBoolean isClosed
    • Constructor Detail

      • BufferedOutput

        public BufferedOutput()
      • BufferedOutput

        public BufferedOutput​(int bufferSize)
    • Method Detail

      • onClosed

        protected abstract void onClosed()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • flush0

        protected abstract GrizzlyFuture<java.lang.Integer> flush0​(Buffer buffer,
                                                                   CompletionHandler<java.lang.Integer> completionHandler)
                                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • newBuffer

        protected abstract Buffer newBuffer​(int size)
      • reallocateBuffer

        protected abstract Buffer reallocateBuffer​(Buffer oldBuffer,
                                                   int size)
      • write

        public void write​(byte data)
                   throws java.io.IOException
        Specified by:
        write in interface Output
        Throws:
        java.io.IOException
      • write

        public void write​(Buffer bufferToWrite)
                   throws java.io.IOException
        Specified by:
        write in interface Output
        Throws:
        java.io.IOException
      • isBuffered

        public boolean isBuffered()
        Specified by:
        isBuffered in interface Output
      • ensureBufferCapacity

        public void ensureBufferCapacity​(int size)
                                  throws java.io.IOException
        Specified by:
        ensureBufferCapacity in interface Output
        Throws:
        java.io.IOException
      • flush

        public GrizzlyFuture<java.lang.Integer> flush​(CompletionHandler<java.lang.Integer> completionHandler)
                                               throws java.io.IOException
        Description copied from interface: Output
        Make sure that all data that has been written is flushed from the stream to its destination.
        Specified by:
        flush in interface Output
        Throws:
        java.io.IOException
      • close

        public GrizzlyFuture<java.lang.Integer> close​(CompletionHandler<java.lang.Integer> completionHandler)
                                               throws java.io.IOException
        Description copied from interface: Output
        Close the StreamWriter and make sure all data was flushed.
        Specified by:
        close in interface Output
        Throws:
        java.io.IOException
      • getBufferedSize

        protected int getBufferedSize()