Lines Matching refs:ByteSource
45 * Tests for the default implementations of {@code ByteSource} methods.
53 suite.addTest(ByteSourceTester.tests("ByteSource.wrap[byte[]]",
55 suite.addTest(ByteSourceTester.tests("ByteSource.empty[]",
167 ByteSource byteSource = new TestByteSource("hamburger\n".getBytes(Charsets.US_ASCII));
170 assertEquals("cfa0c5002275c90508338a5cdb2a9781", byteSource.hash(Hashing.md5()).toString());
177 ByteSource equalSource = new TestByteSource(bytes);
181 ByteSource fewerBytes = new TestByteSource(newPreFilledByteArray(bytes.length / 2));
186 ByteSource oneByteOff = new TestByteSource(copy);
222 * @param offset the first argument to {@link ByteSource#slice}
223 * @param length the second argument to {@link ByteSource#slice}
232 ByteSource source = new TestByteSource(newPreFilledByteArray(input));
233 ByteSource slice = source.slice(offset, length);
282 ByteSource b1 = ByteSource.wrap(new byte[] {0, 1, 2, 3});
283 ByteSource b2 = ByteSource.wrap(new byte[0]);
284 ByteSource b3 = ByteSource.wrap(new byte[] {4, 5});
289 ByteSource.concat(ImmutableList.of(b1, b2, b3)).read());
291 ByteSource.concat(b1, b2, b3).read());
293 ByteSource.concat(ImmutableList.of(b1, b2, b3).iterator()).read());
294 assertEquals(expected.length, ByteSource.concat(b1, b2, b3).size());
295 assertFalse(ByteSource.concat(b1, b2, b3).isEmpty());
297 ByteSource emptyConcat = ByteSource.concat(ByteSource.empty(), ByteSource.empty());
303 ByteSource source = ByteSource.wrap(new byte[] {0, 1, 2, 3});
304 Iterable<ByteSource> cycle = Iterables.cycle(ImmutableList.of(source));
305 ByteSource concatenated = ByteSource.concat(cycle);
311 private static final ByteSource BROKEN_CLOSE_SOURCE
313 private static final ByteSource BROKEN_OPEN_SOURCE
315 private static final ByteSource BROKEN_READ_SOURCE
324 private static final ImmutableSet<ByteSource> BROKEN_SOURCES
336 for (ByteSource in : BROKEN_SOURCES) {
352 for (ByteSource in : BROKEN_SOURCES) {
364 for (ByteSource in : BROKEN_SOURCES) {
380 for (ByteSource in : BROKEN_SOURCES) {
395 private static void runFailureTest(ByteSource in, ByteSink out) {
406 private static int runSuppressionFailureTest(ByteSource in, ByteSink out) {
416 private static ByteSource newNormalByteSource() {
417 return ByteSource.wrap(new byte[10]);