Class CloseableByteSource

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    CloseableDelegateByteSource, InflaterByteSource, LazyDelegateByteSource

    public abstract class CloseableByteSource
    extends com.google.common.io.ByteSource
    implements java.io.Closeable
    Byte source that can be closed. Closing a byte source allows releasing any resources associated with it. This should not be confused with closing streams. For example, ByteTracker uses CloseableByteSources to know when the data associated with the byte source can be released.
    • Constructor Summary

      Constructors 
      Constructor Description
      CloseableByteSource()
      Creates a new byte source.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected abstract void innerClose()
      Closes the by source.
      • Methods inherited from class com.google.common.io.ByteSource

        asCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, isEmpty, openBufferedStream, openStream, read, read, size, sizeIfKnown, slice, wrap
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CloseableByteSource

        public CloseableByteSource()
        Creates a new byte source.
    • Method Detail

      • close

        public final void close()
                         throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • innerClose

        protected abstract void innerClose()
                                    throws java.io.IOException
        Closes the by source. This method is only invoked once, even if close() is called multiple times.
        Throws:
        java.io.IOException - failed to close