/** Validates the parameters before building a controller. */ protected void validate() { Preconditions.checkState( (mMultiImageRequests == null) || (mImageRequest == null), "Cannot specify both ImageRequest and FirstAvailableImageRequests!"); Preconditions.checkState( (mDataSourceSupplier == null) || (mMultiImageRequests == null && mImageRequest == null && mLowResImageRequest == null), "Cannot specify DataSourceSupplier with other ImageRequests! Use one or the other."); }
/** * Creates a new inputstream instance over the specific memory chunk. * * @param nativeMemoryChunk the native memory chunk * @param startOffset start offset within the memory chunk * @param length length of subchunk */ public NativeMemoryChunkInputStream( NativeMemoryChunk nativeMemoryChunk, int startOffset, int length) { super(); Preconditions.checkState(startOffset >= 0); Preconditions.checkState(length >= 0); mMemoryChunk = Preconditions.checkNotNull(nativeMemoryChunk); mStartOffset = startOffset; mEndOffset = startOffset + length > nativeMemoryChunk.getSize() ? nativeMemoryChunk.getSize() : startOffset + length; mOffset = startOffset; mMark = startOffset; }