wood burning stoves
The moose likes Websphere and the fly likes sending pdf files to IBM MQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "sending pdf files to IBM MQ" Watch "sending pdf files to IBM MQ" New topic

sending pdf files to IBM MQ

Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
I need to convert a pdf file to its binary contents so I can send it as a message to an IBM MQ Series. How can i convert pdf to its binary contents in java?
Is there other alternatives besides converting pdf to binary representation? String? Array of Strings?
Anyone? Thanks
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
The easiest way to do this is probably to read the contents of the file with a FileInputStream and then write the contents into a ByteArrayOutputStream. You can then put the ByteArray into your message.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
Thanks for the reply. =) can i convert the byte array to string? because i need to append control numbers before and after the pdf file.
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
What prevents -
1) write contol codes to byte array
2) write file inputstream to byte array
3) write control codes to byte array
4) send byte array
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
Additionally -
You could write your Strings with Message.setStringProperty() calls.
I agree. Here's the link: http://aspose.com/file-tools
subject: sending pdf files to IBM MQ
It's not a secret anymore!