static public <R extends AbstractReadHandle> void receiveContent(R handle, Object content) { if (handle == null) return; HandleImplementation handleImpl = (HandleImplementation) handle; if ( content == null ) { handleImpl.receiveContent(content); } else if ( handleImpl.receiveAs() != null && handleImpl.receiveAs().isAssignableFrom(content.getClass()) ) { handleImpl.receiveContent(content); } else if ( content instanceof String ) { if ( InputStream.class.isAssignableFrom(handleImpl.receiveAs()) ) { handleImpl.receiveContent( new ByteArrayInputStream(getBytes((String) content)) ); } else if ( Reader.class.isAssignableFrom(handleImpl.receiveAs()) ) { handleImpl.receiveContent( new StringReader((String) content) ); } else if ( byte[].class.isAssignableFrom(handleImpl.receiveAs()) ) { handleImpl.receiveContent( getBytes((String) content) ); } else if ( String.class.isAssignableFrom(handleImpl.receiveAs()) ) { handleImpl.receiveContent( content ); } } else { handleImpl.receiveContent(content); } } static private byte[] getBytes(String content) {