I have a java.io.Reader as the return type of my method. But i have Object type of an instance which i get from Database. So how can I convert this to Reader type and return?
I have the following code where getByteArrayObject() return a byte array. and the same i need to return, but the return type is Reader which i cant change.
public Reader getMediaReader(String arg0) {
// TODO Auto-generated method stub
Object obj = getByteArrayObject();
System.out.println("HELLO I AM DETCTED....... in getMediaReader");
return null;
}
need help
thanks.
Based on your edited question …
Assuming that the byte array returned by
getByteArrayObject()is text encoded in some known character set / encoding, then the following should suffice:where
ENCODING_NAMEis the name of the encoding.EDIT – I’d hazard a guess that the
arg0parameter is supposed to contain the encoding name.