// Entity Input Stream
ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
// Entity Stream to be read with ReaderProvider
ReaderProvider rp = new ReaderProvider();
// Check if readable - assert true
assertTrue(rp.isReadable(Reader.class, null, null, null));
assertTrue(rp.isReadable(Object.class, null, null, null));
// Check if readable - assert false
assertFalse(rp.isReadable(StringReader.class, null, null, null));
assertFalse(" Reading from String.class is not supported", rp.isReadable(String.class,
null,
null,
null));
Reader reader = null;
try {
// Read Entity
reader = rp.readFrom(null, null, null, MediaType.WILDCARD_TYPE, null, bais);
} catch (IOException e) {
assertFalse(" Failed to read Entity", true);
}
BufferedReader sr = new BufferedReader(reader);