Hi rob Sorry for the delayed response . I'm attaching a file where the functions are there and the description of the functions . It will give you an idea of how we are doing it . If you require the input and output files do let me know . But I have already explained and shown you the special characters . |
// Writing the string onto the file system.
private boolean stringToFile(String path, String fileName, String data)
{
String finalPath = path + fileName;
boolean isSuccess = false;
try
{
File newFile = new File(finalPath);
FileWriter fw = new FileWriter(newFile);
fw.write(data);
fw.close();
isSuccess = true;
}
catch (IOException e) {
logger.error("Exception occured while saving file to
filesystem");
}
return isSuccess;
}
// Reading the file that is to be put into the qpid queue. (1)
public DataXml() throws IOException {
File file = new File("D:/GPM/GPM/11413/Data.xml");
FileInputStream fis = new FileInputStream(file);
content = new byte[(int) file.length()];
fis.read(content);
}
public void sendFile(){
QPIDMessage
qpidmessage=qpidmessagefilesender.createNewQPIDMessage();
try{
FileMessage mes=new FileMessage();
mes.putData(); // Puts the data.xml file that is read
by the DataXml() (1)
HashMap<String, byte[]> messageMap=mes.getMessage();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(out);
os.writeObject(messageMap);
byte[] b=out.toByteArray();
System.out.println("****************@@@@@@@@@@*********"+b.length);
qpidmessage.writeBytes(b); // writes the qpid
message to be put onto the queue.
os.close();
out.close();
}
catch(Exception e){
e.printStackTrace();
}
qpidmessagefilesender.send(qpidmessage);
}
// Message to be sent on the qpid queue
public void send(QPIDMessage message) {
// TODO Auto-generated method stub
QPIDMessageCreator qpidmessagecreator = new
QPIDMessageCreator(message);
qpidsenderJmsTemplate.send(sendmessagequeuename,
qpidmessagecreator);
logger.debug("message sent to qpid on queue " +
sendmessagequeuename );
}
Thanks Akhil Samnotra Sent from my iPhone
|
