cancel
Showing results for 
Search instead for 
Did you mean: 

Change Payload with Java Mapping

Former Member
0 Kudos

Hi,

I hava this code

public void execute(InputStream arg0, OutputStream arg1)

                              throws StreamTransformationException {

                    String line = null;

                    BufferedReader br = new BufferedReader(new InputStreamReader(arg0));

                    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(arg1));

                    // Get reference to mapping trace

                    trace = (AbstractTrace)map.get(StreamTransformationConstants.MAPPING_TRACE);

                    trace.addInfo("Proccesing...");

                    try {

                              StringBuffer buffer = new StringBuffer();

                              while ((line = br.readLine()) != null) {

                                        buffer.append(line);

                              }

                              String sourcexml=buffer.toString();

                              sourcexml.replaceAll("1024","9999");

                              bw.write(sourcexml);

                              trace.addInfo(sourcexml);

                              bw.flush();

                              br.close();

                              bw.close();

                    } catch (IOException ioe) {

                              trace.addWarning("Could not process source message");

                              throw new RuntimeException(ioe.getMessage());

                    }

                    trace.addInfo("Proccesed");

          }

It works... but I need to change data.

Anybody know how to write or change output?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Solved.

Regards.

Answers (2)

Answers (2)

smavachee
Active Contributor
0 Kudos

Hellow Cerbero,

Elaborate your question please.

Regards,

Sunil

Former Member
0 Kudos

Hi Sunil?

Elaborate?

Dont you see?

Title:

Change Payload with Java Mapping

Question: "Anybody know how to write or change output?"

Regards.

smavachee
Active Contributor
0 Kudos

Oops.! I have missed your last texts.

Check out the last code on this page..How to write console output

Also cross check with.. JAVA Mapping

Its not an exact one what u expect, but hope it helps.!

Regards,

Sunil

Former Member
0 Kudos