List of usage examples for com.google.common.io ByteSource contentEquals
public boolean contentEquals(ByteSource other) throws IOException
From source file:com.tinspx.util.io.ChannelSource.java
@ByteUtils.ThreadLocalArray(8192) static boolean contentEquals(ByteSource source, ByteSource other, boolean first) throws IOException { if (source instanceof BAChannelSource) { BAChannelSource o = (BAChannelSource) source; return contentEquals(other, o.buf, o.off, o.len); } else if (source instanceof ByteArrayChannelSource) { byte[] b = ((ByteArrayChannelSource) source).read(); return contentEquals(other, b, 0, b.length); } else if (source instanceof BAOutputStream.BAOSChannelSource) { return source.contentEquals(other); } else if (source instanceof ByteBufferChannelSource) { ByteBuffer b = ((ByteBufferChannelSource) source).buf; if (b.hasArray()) { return contentEquals(other, b.array(), b.arrayOffset() + b.position(), b.remaining()); }/* w w w . ja v a2s .c o m*/ } else if (source instanceof MemoizeChannelSource) { return contentEquals(((MemoizeChannelSource) source).delegateThrow(), other, first); } if (first) { return contentEquals(other, source, false); } else { return ByteUtils.contentEqualsImpl(other, source); } }