Revision history [back]

click to hide/show revision 1
initial version

answered 2013-08-14 21:33:47 +0800

gyowanny gravatar image gyowanny

lol Too early.

I was missing the OutputStream loading. The code excerpt below did the job:

                ByteArrayOutputStream bios = new ByteArrayOutputStream();
                byte[] ba1 = new byte[1024];
                int baLength;
                while ((baLength = is.read(ba1)) != -1) {
                    bios.write(ba1, 0, baLength);
                } 
                AMedia amedia = new AMedia("myfile.pdf",
                    "pdf", "application/pdf", bios.toByteArray());

I hope this code can help another dudes with the same problem.

Thank you,

Gyo

lol Too early.

I was missing the OutputStream loading. The code excerpt below did the job:trick:

                ByteArrayOutputStream bios = new ByteArrayOutputStream();
                byte[] ba1 = new byte[1024];
                int baLength;
                while ((baLength = is.read(ba1)) != -1) {
                    bios.write(ba1, 0, baLength);
                } 
                AMedia amedia = new AMedia("myfile.pdf",
                    "pdf", "application/pdf", bios.toByteArray());

I hope this code can help another dudes with the same problem.

Thank you,

Gyo

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More