Class LazyDelegateByteSource
- java.lang.Object
-
- com.google.common.io.ByteSource
-
- com.android.tools.build.apkzlib.zip.utils.CloseableByteSource
-
- com.android.tools.build.apkzlib.zip.LazyDelegateByteSource
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class LazyDelegateByteSource extends CloseableByteSource
ByteSourcethat delegates all operations to anotherByteSource. The other byte source, the delegate, may be computed lazily.
-
-
Constructor Summary
Constructors Constructor Description LazyDelegateByteSource(com.google.common.util.concurrent.ListenableFuture<CloseableByteSource> delegate)Creates a new byte source that delegates operations to the provided source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.io.CharSourceasCharSource(java.nio.charset.Charset charset)booleancontentEquals(com.google.common.io.ByteSource other)longcopyTo(com.google.common.io.ByteSink sink)longcopyTo(java.io.OutputStream output)com.google.common.util.concurrent.ListenableFuture<CloseableByteSource>getDelegate()Obtains the delegate future.com.google.common.hash.HashCodehash(com.google.common.hash.HashFunction hashFunction)voidinnerClose()Closes the by source.booleanisEmpty()java.io.InputStreamopenBufferedStream()java.io.InputStreamopenStream()byte[]read()<T> Tread(com.google.common.io.ByteProcessor<T> processor)longsize()com.google.common.io.ByteSourceslice(long offset, long length)-
Methods inherited from class com.android.tools.build.apkzlib.zip.utils.CloseableByteSource
close
-
-
-
-
Constructor Detail
-
LazyDelegateByteSource
public LazyDelegateByteSource(com.google.common.util.concurrent.ListenableFuture<CloseableByteSource> delegate)
Creates a new byte source that delegates operations to the provided source.- Parameters:
delegate- the source that will receive all operations
-
-
Method Detail
-
getDelegate
public com.google.common.util.concurrent.ListenableFuture<CloseableByteSource> getDelegate()
Obtains the delegate future.- Returns:
- the delegate future, that may be computed or not
-
asCharSource
public com.google.common.io.CharSource asCharSource(java.nio.charset.Charset charset)
- Overrides:
asCharSourcein classcom.google.common.io.ByteSource
-
openBufferedStream
public java.io.InputStream openBufferedStream() throws java.io.IOException- Overrides:
openBufferedStreamin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
slice
public com.google.common.io.ByteSource slice(long offset, long length)- Overrides:
slicein classcom.google.common.io.ByteSource
-
isEmpty
public boolean isEmpty() throws java.io.IOException- Overrides:
isEmptyin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOException- Overrides:
sizein classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
copyTo
public long copyTo(java.io.OutputStream output) throws java.io.IOException- Overrides:
copyToin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
copyTo
public long copyTo(com.google.common.io.ByteSink sink) throws java.io.IOException- Overrides:
copyToin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
read
public byte[] read() throws java.io.IOException- Overrides:
readin classcom.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:
readin classcom.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:
hashin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
contentEquals
public boolean contentEquals(com.google.common.io.ByteSource other) throws java.io.IOException- Overrides:
contentEqualsin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
openStream
public java.io.InputStream openStream() throws java.io.IOException- Specified by:
openStreamin classcom.google.common.io.ByteSource- Throws:
java.io.IOException
-
innerClose
public void innerClose() throws java.io.IOExceptionDescription copied from class:CloseableByteSourceCloses the by source. This method is only invoked once, even ifCloseableByteSource.close()is called multiple times.- Specified by:
innerClosein classCloseableByteSource- Throws:
java.io.IOException- failed to close
-
-