Interface Closeable

    • Method Detail

      • isOpen

        boolean isOpen()
        Is Closeable open and ready. Returns true, if the Closeable is open and ready, or false otherwise.
        Returns:
        true, if Closeable is open and ready, or false otherwise.
      • assertOpen

        void assertOpen()
                 throws IOException
        Checks if this Closeable is open and ready to be used. If this Closeable is closed then an IOException will be thrown
        Throws:
        IOException - giving the reason why this Closeable was closed.
      • terminateSilently

        void terminateSilently()
        Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. Use this method, when no completion notification is needed.
      • terminate

        GrizzlyFuture<Closeable> terminate()
        Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.
        Returns:
        Future, which could be checked in case, if close operation will be run asynchronously
      • terminateWithReason

        void terminateWithReason​(IOException cause)
        Closes the Closeable and provides the reason description. This method is similar to terminateSilently(), but additionally provides the reason why the Closeable will be closed.
        Parameters:
        cause - reason why terminated. This will be thrown is isOpen() is called subsequently
      • closeSilently

        void closeSilently()
        Gracefully (if supported by the implementation) closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. Use this method, when no completion notification is needed.
      • close

        GrizzlyFuture<Closeable> close()
        Gracefully (if supported by the implementation) closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.
        Returns:
        Future, which could be checked in case, if close operation will be run asynchronously
        See Also:
        which is not asynchronous
      • closeWithReason

        void closeWithReason​(IOException cause)
        Gracefully closes the Closeable and provides the reason description. This method is similar to closeSilently(), but additionally provides the reason why the Closeable will be closed.
        Parameters:
        cause - reason why closed, this will be thrown by isOpen() if called subsequently
      • addCloseListener

        void addCloseListener​(CloseListener closeListener)
        Add the CloseListener, which will be notified once the stream will be closed.
        Parameters:
        closeListener - CloseListener.
      • removeCloseListener

        boolean removeCloseListener​(CloseListener closeListener)
        Remove the CloseListener.
        Parameters:
        closeListener - CloseListener.
        Returns:
        true if the listener was successfully removed, or false otherwise.