InputStreamUtil { public static BufferedInputStream toBufferedInputStream( InputStream inputStream) { if (inputStream instanceof BufferedInputStream) { return (BufferedInputStream)inputStream; } return new BufferedInputStream(inputStream); }  static BufferedInputStream toBufferedInputStream(
		InputStream inputStream);  }
@Test public void testBufferedInputStreamIsNotWrapped() { InputStream inputStream = new BufferedInputStream( new ByteArrayInputStream(new byte[0])); Assert.assertSame( inputStream, InputStreamUtil.toBufferedInputStream(inputStream)); }
@Test public void testUnbufferedInputStreamIsWrapped() { InputStream inputStream = new ByteArrayInputStream(new byte[0]); Assert.assertNotSame( inputStream, InputStreamUtil.toBufferedInputStream(inputStream)); }