Class CloseableDelegateByteSource

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class CloseableDelegateByteSource
    extends CloseableByteSource
    Closeable byte source that delegates to another byte source.
    • Constructor Summary

      Constructors 
      Constructor Description
      CloseableDelegateByteSource​(com.google.common.io.ByteSource inner, long size)
      Creates a new byte source.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.common.io.CharSource asCharSource​(java.nio.charset.Charset charset)  
      boolean contentEquals​(com.google.common.io.ByteSource other)  
      long copyTo​(com.google.common.io.ByteSink sink)  
      long copyTo​(java.io.OutputStream output)  
      com.google.common.hash.HashCode hash​(com.google.common.hash.HashFunction hashFunction)  
      protected void innerClose()
      Mark the byte source as disposed.
      boolean isEmpty()  
      java.io.InputStream openBufferedStream()  
      java.io.InputStream openStream()  
      byte[] read()  
      <T> T read​(com.google.common.io.ByteProcessor<T> processor)  
      long size()  
      long sizeNoException()
      Obtains the size of this byte source.
      com.google.common.io.ByteSource slice​(long offset, long length)  
      • Methods inherited from class com.google.common.io.ByteSource

        concat, concat, concat, empty, sizeIfKnown, wrap
      • Methods inherited from class java.lang.Object

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

      • CloseableDelegateByteSource

        public CloseableDelegateByteSource​(com.google.common.io.ByteSource inner,
                                           long size)
        Creates a new byte source.
        Parameters:
        inner - the inner byte source
        size - the size of the source
    • Method Detail

      • innerClose

        protected void innerClose()
                           throws java.io.IOException
        Mark the byte source as disposed.
        Specified by:
        innerClose in class CloseableByteSource
        Throws:
        java.io.IOException - failed to close
      • sizeNoException

        public long sizeNoException()
        Obtains the size of this byte source. Equivalent to size() but not throwing IOException.
        Returns:
        the size of the byte source
      • asCharSource

        public com.google.common.io.CharSource asCharSource​(java.nio.charset.Charset charset)
        Overrides:
        asCharSource in class com.google.common.io.ByteSource
      • openBufferedStream

        public java.io.InputStream openBufferedStream()
                                               throws java.io.IOException
        Overrides:
        openBufferedStream in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • slice

        public com.google.common.io.ByteSource slice​(long offset,
                                                     long length)
        Overrides:
        slice in class com.google.common.io.ByteSource
      • isEmpty

        public boolean isEmpty()
                        throws java.io.IOException
        Overrides:
        isEmpty in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • size

        public long size()
                  throws java.io.IOException
        Overrides:
        size in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • copyTo

        public long copyTo​(java.io.OutputStream output)
                    throws java.io.IOException
        Overrides:
        copyTo in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • copyTo

        public long copyTo​(com.google.common.io.ByteSink sink)
                    throws java.io.IOException
        Overrides:
        copyTo in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • read

        public byte[] read()
                    throws java.io.IOException
        Overrides:
        read in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • read

        public <T> T read​(com.google.common.io.ByteProcessor<T> processor)
                   throws java.io.IOException
        Overrides:
        read in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • hash

        public com.google.common.hash.HashCode hash​(com.google.common.hash.HashFunction hashFunction)
                                             throws java.io.IOException
        Overrides:
        hash in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • contentEquals

        public boolean contentEquals​(com.google.common.io.ByteSource other)
                              throws java.io.IOException
        Overrides:
        contentEquals in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException
      • openStream

        public java.io.InputStream openStream()
                                       throws java.io.IOException
        Specified by:
        openStream in class com.google.common.io.ByteSource
        Throws:
        java.io.IOException