public void testRead() throws IOException
{
String buffer = "Hello this is a very friendly little buffer";
ByteArrayInputStream input = new ByteArrayInputStream(buffer.getBytes());
LengthInputStream lis = new LengthInputStream(input, 20);
StringBuilder result = new StringBuilder();
int c;
while ( (c = lis.read()) != -1 )
{
result.append( (char) c);
}
lis.close();
assertEquals( buffer.substring(0, 20), result.toString() );
}