Package com.google.common.io.SourceSinkFactory

Examples of com.google.common.io.SourceSinkFactory.ByteSourceFactory


  }

  public static ByteSourceFactory asSlicedByteSourceFactory(final ByteSourceFactory factory,
      final int off, final int len) {
    checkNotNull(factory);
    return new ByteSourceFactory() {
      @Override
      public ByteSource createSource(byte[] bytes) throws IOException {
        return factory.createSource(bytes).slice(off, len);
      }
View Full Code Here


      Random random = new Random();
      byte[] expected = factory.getExpected(bytes);
      // if expected.length == 0, off has to be 0 but length doesn't matter--result will be empty
      int off = expected.length == 0 ? 0 : random.nextInt(expected.length);
      int len = expected.length == 0 ? 4 : random.nextInt(expected.length - off);
      ByteSourceFactory sliced = SourceSinkFactories.asSlicedByteSourceFactory(factory, off, len);
      suite.addTest(suiteForBytes(sliced, bytes, name + ".slice[int, int]",
          desc, false));
    }

    return suite;
View Full Code Here

TOP

Related Classes of com.google.common.io.SourceSinkFactory.ByteSourceFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.