@Test(expected = NullPointerException.class) public void nullBody() { Streams.create(null); }
public static InputStream create(final Body body) { checkNotNull(body); switch (body.getDataType()) { case NONE: return NONE_INPUTSTREAM; case ZEROES: return create(ZERO_BUF, body.getSize()); case CUSTOM: return create(body.getContent().getBytes(Charsets.UTF_8), body.getSize()); default: return create(createRandomBuffer(body.getRandomSeed()), body.getSize()); } }
Streams { public static InputStream create(final Body body) { checkNotNull(body); switch (body.getDataType()) { case NONE: return NONE_INPUTSTREAM; case ZEROES: return create(ZERO_BUF, body.getSize()); case CUSTOM: return create(body.getContent().getBytes(Charsets.UTF_8), body.getSize()); default: return create(createRandomBuffer(body.getRandomSeed()), body.getSize()); } } }
Streams { public static InputStream create(final Body body) { checkNotNull(body); switch (body.getDataType()) { case NONE: return NONE_INPUTSTREAM; case ZEROES: return create(ZERO_BUF, body.getSize()); case CUSTOM: return create(body.getContent().getBytes(Charsets.UTF_8), body.getSize()); default: return create(createRandomBuffer(body.getRandomSeed()), body.getSize()); } } private  Streams(); }
Streams { public static InputStream create(final Body body) { checkNotNull(body); switch (body.getDataType()) { case NONE: return NONE_INPUTSTREAM; case ZEROES: return create(ZERO_BUF, body.getSize()); case CUSTOM: return create(body.getContent().getBytes(Charsets.UTF_8), body.getSize()); default: return create(createRandomBuffer(body.getRandomSeed()), body.getSize()); } } private  Streams(); static InputStream create(final Body body); static InputStream throttle(final InputStream in, final long bytesPerSecond); static OutputStream throttle(final OutputStream out, final long bytesPerSecond); }
Streams { public static InputStream create(final Body body) { checkNotNull(body); switch (body.getDataType()) { case NONE: return NONE_INPUTSTREAM; case ZEROES: return create(ZERO_BUF, body.getSize()); case CUSTOM: return create(body.getContent().getBytes(Charsets.UTF_8), body.getSize()); default: return create(createRandomBuffer(body.getRandomSeed()), body.getSize()); } } private  Streams(); static InputStream create(final Body body); static InputStream throttle(final InputStream in, final long bytesPerSecond); static OutputStream throttle(final OutputStream out, final long bytesPerSecond); static final int REPEAT_LENGTH; }