Perhaps this can help:

http://stackoverflow.com/questions/20706783/put-byte-array-to-json-and-vice-versa

Sergey
On 24/02/15 23:00, Sonam Samdupkhangsar wrote:
Hi,

I have a Java Object:

class MyFile {
   Long id;
byte[] myBytes;

}

I have a JAXRS service that returns MyFile objects:

@GET
@Produces ( "application/json" )
@Path("/new")
public Set<MyFile> getMyFiles();


On the Javascript-client side, the contents of MyFile.myBytes is encoded in Base64 (not sure but looks 
like it).    The myBytes is a byte array containing a PDF file.  I used the "atob()" javascript 
method to get the binary (blob) data but I am not able to display the pdf file using the HTML's 
"<embed>" tag.
Not sure if this helps but I see this error on Firefox console : "Error: Invalid 
XRef stream header".

Thanks

-Sonam





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to