Redirect output to file?

Hi there,
is it possible to redirect the output of a canvas3d to file (jpg or so)?
greetz, ToM

Use this as a starting point: http://forums.java.net/jive/thread.jspa?forumID=70&threadID=13134&messageID=101107#101107
Mike

Similar Messages

  • Running function with "Write-Host" and redirect output to file does nothing.

    Hello,
    I created this function:
    function TicketSolutionInformation {
    Write-Host "User has been created." -ForegroundColor Green
    TicketSolutionInformation | Out-File -filepath ("123" + ".txt") -append
    but the file 123.txt is always empty. Why ?

    Write-Host will write text to console, not pipepeline so you'll always get nothing.
    Consider changing function to this:
    function TicketSolutionInformation {
    Param(
    [switch]$Passthru
    Write-Host "User has been created." -ForegroundColor Green
    if($Passthru){
    "User has been created."
    }TicketSolutionInformation -Passthru | Out-File -filepath ("123" + ".txt") -append

  • Redirect standart output to file

    i want to ask how to redirect standart output to file,
    if i have statement like this System.out.println("hello"); i want hello not print in console but print to file
    thx

    Here is sample code for that:
      static{
        try {
          PrintStream obj_ps = new PrintStream(new FileOutputStream("internal.log"));
          System.setOut(obj_ps);
          System.setErr(obj_ps);
        catch (FileNotFoundException ex) {
          JOptionPane.showMessageDialog(null, "Error creating log file", "Error", JOptionPane.ERROR_MESSAGE);
      }

  • Invoking a call to a window executable fails when request output to file

    Hi,
    When invoking a call to a window executable it fails(returns 1 instead of 0) when requesting output to file by using "> filename.txt". This nornally works when run directly within a
    windows command prompt, and it also works if I don't add the "> filename.txt" at the end. Also instead of outputting to a file I would like the same called executable to output to a memory variable that I can extract data without going to a external text file.
    Below is the .java file
    package com.insequence.gv;
    public class Jinvoker {
              public static int invoke(String program) throws java.io.IOException, java.lang.InterruptedException
                   System.out.println("invoking program: " + program);
                   Process p = Runtime.getRuntime().exec(program);
                   int exitValue = p.waitFor();
                   return exitValue;
              public static void main(String[] argv)
                   try
                   System.out.println("invoker start");
    //               int retval = invoke("c:\\tvalesky\\java\\invoker\\targetexe arg1 arg2 arg3");
    //               int retval = invoke("C:\\Program Files\\FWTools1.1.0\\bin\\gdalinfo.exe C:\\data\\EarthData2005\\Ortho\\no_collaged.tif");
                   String arg1 = "C:\\data\\EarthData2005\\Ortho\\no_collaged.tif > c:\\testing.txt";
    //               String arg1 = "C:\\data\\EarthData2005\\Ortho\\no_collaged.tif";
                   int retval = invoke("C:\\Program Files\\FWTools1.1.0\\bin\\gdalinfo.exe " + arg1);
    //               int retval = invoke("C:\\Program Files\\FWTools1.1.0\\bin\\gdalinfo.exe");
    //               String arg1 = "-s_srs epsg:26915 -t_srs epsg:4326 C:\\data\\EarthData2005\\Ortho\\no_collaged.tif C:\\data\\EarthData2005\\Ortho\\no_collaged2.tif";
    //               int retval = invoke("C:\\Program Files\\FWTools1.1.0\\bin\\gdalwarp.exe " + arg1);
    //               int retval = invoke("C:\\testing.bat C:\\data\\EarthData2005\\Ortho\\no_collaged2.tif");
                   System.out.println("invoker end: returned " + retval);
                   catch(java.io.IOException e)
                        System.out.println("IOException caught: " + e);
                   catch(java.lang.InterruptedException e)
                        System.out.println("InterruptedException caught: " + e);
    Thanks,
    John Mitchell

    Well, if you ultimately want the output from the process, you don't need to redirect it to a file first. Just read from the standard output of the process. See [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getInputStream()]Process.getInputStream and Process.getErrorStream. You'll need to read from both simultaneously so you'll need to create two threads. You could also use [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html]ProcessBuilder if you're using Java 1.5

  • Redirect output

    i am coding an application which uses some open source libraries. i don't want to have anything output to the standard output. i have the control in my application, but when there is an exception or whatever other error condition, the open source libraries will output printStackTrace() to terminal window. just wondering how do i stop other libraries from printing out to screen without changing their code?
    thanks in advance

    you could also redirect the output to files when starting your application
    java yourprogram >> prog_stdout.txt 2>> prog_stderr.txt
    hf,
    dani

  • Redirecting output from plink

    I am currently trying to write a function that runs plink and captures the output from that process.  When I try StandardOutput I get nothing and when I try StandardError I get "Unable to read from standard input: The handle is invalid."  I can only assume that this means I am trying to read while plink is waiting for input.  I am also passing my command via a text file called apCommands.txt.  When I run this command manually it works and gives me the required output, I just can't figure out why I can't redirect that output so I can store it in a results file.  Here is the code I have right now.
    string pArgs = "-m \"" + ABSPATH + "\\apCommands.txt\" -ssh myHost -l user -pw password";
    string output;
    if (File.Exists(ABSPATH + "\\apTest.txt"))
    File.Delete(ABSPATH + "\\apTest.txt");
    StreamWriter apTest = new StreamWriter(ABSPATH + "\\apTest.txt");
    Process runAP = new Process();
    ProcessStartInfo apInfoStart = new ProcessStartInfo(ABSPATH + "\\plink.exe");
    apInfoStart.Arguments = pArgs;
    apInfoStart.RedirectStandardOutput = true;
    apInfoStart.CreateNoWindow = true;
    apInfoStart.UseShellExecute = false;
    runAP.StartInfo = apInfoStart;
    runAP.Start();
    output = runAP.StandardOutput.ReadToEnd();
    runAP.WaitForExit();
    apTest.WriteLine("Standard Output");
    apTest.WriteLine(output);
    apTest.Close();
    runAP.Close();
    Thanks,
    Joe

    I see.  I wasn't aware that it wasn't a reliable way to connect to ssh.  As for the error message that was from standardError.  I think the process may have been waiting for input when I was trying to read from StandardOutput and thats why I got that error message.  Also instead of redirecting StandardOutput I tried redirecting the output directly into a file by running a cmd process and passing the commands I wanted to run through StandardInput.  The underlined section is all I changed besides running this inside of a cmd process.  This did work for me but I would rather know how to do it using StandardOutput. 
    string dArgs = "cd \"" + ABSPATH + "\"";
    string pArgs = "plink -ssh myHost -m \"" + ABSPATH + "\\apCommands\" -l user -pw password > test.out";
    Process runAP = new Process();
    ProcessStartInfo apInfoStart = new ProcessStartInfo("cmd");
    //apInfoStart.Arguments = pArgs;
    apInfoStart.RedirectStandardInput = true;
    apInfoStart.RedirectStandardOutput = true;
    apInfoStart.CreateNoWindow = true;
    apInfoStart.UseShellExecute = false;
    runAP.StartInfo = apInfoStart;
    runAP.Start();
    runAP.StandardInput.WriteLine(dArgs);
    runAP.StandardInput.WriteLine(pArgs);
    I haven't tried reading the StandardOutput from this piece of code, but I will probably try it.
    Thanks,
    Joe

  • In R12 how to change concurrent output/log file name prefix?

    how to change concurrent output/log file name prefix?

    but i want to change change concurrent output/log file name prefix?You cannot, and I believe it is not supported for all concurrent requests -- Please log a SR to confirm this with Oracle support.
    Thanks,
    Hussein

  • How to remove the extra space in the output pdf file?

    Hi All
    In our RTF layout template we have both static content and dynamic content.
    In RTF template we have used many if-else,choose,For each loops.
    On the account of that,In the output pdf file, we are getting lot of empty space in the place of that coding(if-else,choose,For each loops).
    Is there anyway to reduce the space in the output pdf file?
    Please suggest some ideas.
    Thanks in Advance.

    White space is NOT your friend!
    Make sure you don't have any unwanted whitespace between commands and especially tagged on the end of lines. Chain your commands together with no whitespace and let them wrap, do not enter carriage returns.
    Cheers,
    Dave

  • Not able to map contents of xml to output using file adapter

    Hi
    i m not able to map the output of file adapter to a variable when reading an xml. the data is coming in the file adapter output variable but it is not mapping to other variable in assign or transform activity.I m using jdeveloper 11.1.1.4.0.Can anbody help me plz.
    Regards
    Sourbh

    i am using file adapter as reference to synchronously read an xml file. i am able to see the flow trace in em console. the output variable of file adapter contains the data but when i m trying to assign the value to a variable i getting error. saying that some xpath is not returing any value.
    i tried with transform activity also but same case is there.

  • Monitor CPU and send output to file

    Hello
    I want to monitor my CPU usage and my idea was this:
    1. Use Top (/usr/bin/top –n 1|head –n 3| tail –n 1|awk ’{print $2}’)
    2. Send output to file
    3. crontab it
    My problem is now that my top command (see above) works fine in terminal, it will give me a short and clean answer; 10.5%
    But when sending this to a file the output looks more like: 10.5%^^8fewfwe[]€]]@£]@£[f9@£[]^^E^Efewfwef23 (Yes i just hit my keyboard but its alot of randoms characters)
    How can i fix this?
    Do you have any easier solution to monitor my CPU usage, i want it to be quite often, send cpu usage to file for at least every minute, then i can import this to excel and make nice diagram.
    I dont want to install any extra program so ill have to work with whats there already. Im using RHEL 4.
    Thanks in advance, Johan

    A better way to do it is using "sar"
    man sarIt's already builtin and there are plenty of docs on the net.
    kido

  • Output Mutiple Files Using htp.p

    Hello,
    I wish to output 3 CSV files from APEX I have the following code
    Declare
    S_FileName VarChar(20);
    S_Counter Number;
    begin
    -- Set the File NAme
    S_FileName :=To_char(sysdate,'yyyymmdd')||'Letters.CSV';
    For S_Counter IN 1..4 LOOP
    -- Set the MIME type
    owa_util.mime_header( 'application/octet', FALSE );
    -- Set the name of the file
    htp.p('Content-Disposition: attachment; filename="'||S_FILENAME||S_Counter|| '"');
    -- Close the HTTP Header
    owa_util.http_header_close;
    -- Loop through all rows in EMP
    for x in (select MPAN_CORE,ACCOUNT_NO
    from Categoriser.LTNA_LETTER_ONE_OUTPUT@link_to_dqmDevdb )
    loop
    -- Print out a portion of a row,
    -- separated by commas and ended by a CR
    htp.prn(x.MPAN_CORE ||','|| x.ACCOUNT_NO ||','||
    x.MPAN_CORE || chr(13));
    END LOOP;
    END LOOP;
    -- Send an error code so that the-- rest of the HTML does not render
    htmldb_application.g_unrecoverable_error := true;
    end;
    At this stage i only want to output 3 files the content is not a issue
    I it possible to do this with APEX?
    Any help on this is greatly appreciated.
    David

    I take it from the lack of response that this is not somthing that APEX can do?No, it's something that HTTP cannot do. Think about it: if it was possible for a server to send multiple files in response to an HTTP request, then it would be possible to break your computer very easily indeed.
    aww well looks like i will need to find another way..You'd need something in the browser client-side, Java applet, Flash control etc...

  • Java.sql.SQLException: File input/output error: File input/output error: re

    Hi,
    We are using JCAPS 512. We use oracle eway to connect to Oracle 10g database. But sometimes we are getting the following exception
    and suddenly all jcds stop processing. If we restart the server again job continue processing, otherwise server hangs and nothing get processed.
    Exception is as follows
    java.sql.SQLException: File input/output error: File input/output error: reading: java.io.EOFException in statement [SET TABLE EVENT_STORE INDEX '11183416 55935']
         at org.hsqldb.Trace.getError(Unknown Source)
         at org.hsqldb.Log.runScript(Unknown Source)
         at org.hsqldb.Log.open(Unknown Source)
         at org.hsqldb.Database$Logger.openLog(Unknown Source)
         at org.hsqldb.Database.open(Unknown Source)
         at org.hsqldb.Database.<init>(Unknown Source)
         at org.hsqldb.jdbcConnection.openStandalone(Unknown Source)
         at org.hsqldb.jdbcConnection.<init>(Unknown Source)
         at org.hsqldb.jdbcDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.addNewConnection(DBEventStore.java:359)
         at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.getConnection(DBEventStore.java:444)
         at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.executeParameterizedQuery(DBEventStore.java:777)
         at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.access$000(DBEventStore.java:250)
         at com.stc.eventmanagement.impl.DBEventStore.getEventIDsList(DBEventStore.java:133)
         at com.stc.eventmanagement.impl.DBEventStore.getEventIDsList(DBEventStore.java:115)
         at com.stc.eventmanagement.impl.EventForwarderMBean.cachePersistedEvents(EventForwarderMBean.java:728)
         at com.stc.eventmanagement.impl.EventForwarderMBean.setup(EventForwarderMBean.java:334)
         at com.stc.eventmanagement.impl.EventForwarderMBean.invoke(EventForwarderMBean.java:565)
         at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
         at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
         at com.stc.eventmanagement.impl.EventManagementService.setupEventForwarderMbean(EventManagementService.java:270)
         at com.stc.eventmanagement.impl.EventManagementService.registerMBean(EventManagementService.java:147)
         at com.stc.eventmanagement.impl.EventManagementService.startService(EventManagementService.java:96)
         at com.stc.eventmanagement.impl.EventManagementResourceAdapter.start(EventManagementResourceAdapter.java:75)
         at com.sun.enterprise.connectors.ActiveInboundResourceAdapter.<init>(ActiveInboundResourceAdapter.java:94)
         at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:74)
         at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:269)
         at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:372)
         at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:204)
         at com.sun.enterprise.server.ConnectorModuleLoader.load(ConnectorModuleLoader.java:87)
         at com.sun.enterprise.server.ConnectorModuleLoader.load(ConnectorModuleLoader.java:108)
         at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:216)
         at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:106)
         at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:183)
         at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:295)
         at com.sun.enterprise.server.PEMain.run(PEMain.java:238)
         at com.sun.enterprise.server.PEMain.main(PEMain.java:186)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
    |#]
    Please provide some suggestions to overcome this  error
    Regards
    Venkatesh.S

    Delete the EventStoreDb.data file (its somewhere in your logical host) and restart the logical host.

  • Output XML file problem (in FILE to RFC scenario)

    hi,
       my problem is that in the export parameter i have 3 variables but my output xml file shows only 2 parameters . I have checked my mapping all 3 parameters are mapped properly in output mapping .
    Initially when i started the scenario there were only 2 parameters in my export list .
    i completed this suuccesfully and then as per new requirement one more parameter was needed to be added i added a new parameter and reimported my rfc .
    the response tab of the reimported RFC shows me the newly added parameter but my final xml file only shows me the previous 2 it doesnt show me the newly added one is there any seeting which i need to change like in idoc where we have to readd the idoc in IDX2
    With regards
    Bhawarlal Choudhary

    Hi,
    2 Introduction
    Configuring IDoc adapter in Exchange Infrastructure 3.0 requires some configuration on the SAP
    systems, for both XI and the backend system where the IDoc message is to be sent. These steps, although
    simple, are many times missed or mis-configured, causing the delivery of messages to fail.
    Since IDoc adapter uses the ABAP stack, instead of J2EE, the configuration requirements are mainly in
    ABAP.
    Setting up IDoc adapters requires the XI integration server to be able to communicate with the backend
    SAP system, and also to make sure that the Logical System Name used when posting IDoc exists on the
    backend SAP system.
    3 The Step By Step Solution
    The basic steps for the IDoc configuration are outline below:
    1. Configure SM59 on XI to communicate to SAP backend system.
    2. Configure port on XI for IDoc communication.
    3. Create or verify the Logical System Name on the SAP backend system.
    4. Create or verify business system in XI’s System Landscape Directory.
    5. Verify the Logical System Name of the business system.
    6. Verify or add the Logical System Name for the sender business system.
    7. Create/configure the Communication Channel for the IDoc receiver adapter
    3.1 Configure SM59 on XI to communicate to SAP backend system.
    1. Using transaction SM59, create an RFC destination with Connection Type = “3”.
    In this example, the RFC destination name is “NDVCLNT510”.
    2. Enter the logon information:
    3. Test the connection by clicking on “Testing connection” and “Remote logon”.
    Both must be successful.
    3.2 Configure port on XI for IDoc communication.
    4. Go to transaction IDX1 on XI, and create a port. In this example, the Port name is “SAPNDV”.
    •     &#61472;The Port name must be in the form of “SAPxxx”, where xxx is the system ID of the backend SAP
    system.
    •     The Client must be the client number of the backend SAP system.
    •     Select the RFC Destination which was created in the previous step.
    3.3 Create or verify the Logical System Name on the SAP backend system.
    5. Enter transaction SALE on the SAP backend system.
    6. Create or verify the Logical System Name. In our example, NDVCLNT510 is verified.
    3.4 Create or verify business system in XI’s System Landscape Directory.
    The business system name for the SAP backend system must contain a valid Logical System Name. This Logical System Name is the one verified or created in the previous step.
    7. In the System Landscape Directory,  select the SAP backend business system. If one does not exist, then create the business system. Verify the Logical  System Name.
    3.5 Verify the Logical System Name of the business system.
    8. In the Integration Directory, doubleclick on the business system (in our example, it is NDVCLNT510).
    Navigate the menu:
    Service • Adapter Specific Identifiers.
    If information is empty or incorrect, then it will have to be synchronized with the content of the System Landscape Directory. Follow the steps below for synchronization.
    9. (Optional) Synchronization of the business system in Integration Directory to the business system in System
    Landscape Directory.
    •     &#61472;Double-click on the business system in the Integration Directory.
    •     &#61472;Switch to Edit mode.
    •     &#61472;Select menu: Service • Adapter-Specific Identifiers 
    10. (Optional) Within the dialog box, click on the button as indicated below to resynchronize.
    11. (Optional) If the expected data from the System Landscape Directory is not updated, then the SLD cache may need to be cleared first.
    3.7 Create/configure the Communication Channel for the IDoc receiver adapter.
    15. In the Integration Directory, create an IDoc receiver communication channel.
    •     &#61472;The RFC Destination is from step 3.1.
    •     &#61472;The Port is from step 3.2.
    NOTE:
    There is no need to create an IDoc sender Communication Channel for XI. Instead, the backend SAP system must be configure to send the IDoc to XI.
    4 Appendix
    Transaction: IDX2
    There are a couple of situation where IDX2 can be useful on the XI system.
    1. When we want to test connection between the XI and SAP backend system.
    2. When an IDoc has changed, and the meta data stored in XI needs to be update. When an IDoc is sent from the SAP backend system to XI, XI will first check to see if the meta data for the IDoc is already in its persistent cache. If not, then XI will use the configuration in IDX1 to retrieve the IDoc meta data from the backend system. If the
    meta is already in cache, then it will NOT do so. Therefore, when an IDoc has changed, it is necessary to manually update the new meta data on XI, or delete it from the cache, so that the latest version can be retrieved. IDX2 is used for this purpose.
    Go to transaction IDX2 and click on “Create”.
    Enter the IDoc Type and the Source Port as defined in step #2. Click “Continue”.If successful, the following will show up. If error occurs, then the IDX1 configurations will need to be re-checked.
    Regards
    Hemant
    If find helpful plz award points

  • Problem with RTPExport output video files

    Hi, I have a problem with RTPExport output video files. One side streams H263/RTP(AVTransmit2.java) and other write this steam to a file by RTPExport.java. When network conditions are ideal, output video file has same fps and same number of frames like original file. Problem occures, when theres packet lost in network, then output file has different fps,and also has less frames like original video(because it didnt write missing frames to file, and thats why it get shorter). Pls how can I achieve output file that will have the same fps like original one? How to write to file an identical copy of what I can see while receiveing video with AVReceive2.java? Its there a way to modifi rtpexport or avreceiver to do this? Thanks a lot!

    Trubka wrote:
    When network conditions are ideal, output video file has same fps and same number of frames like original file. Problem occures, when theres packet lost in network, then output file has different fps,and also has less frames like original video(because it didnt write missing frames to file, and thats why it get shorter). Okay, first off, the second file is smaller on purpose. RTP intentionally drops packets that are old/out of order in order to make sure real-time video stays as close to real time as it can. This is by design, so there's really nothing that can be done about it.
    How to write to file an identical copy of what I can see while receiveing video with AVReceive2.java? Technically speaking, what you're getting in the RTPExport is exactly what you got on the receiving end. Any frames that are dropped during transmission will not be seen by the receiver, nor saved by the receiver.
    Pls how can I achieve output file that will have the same fps like original one? I'm not 100% sure that you can, but, you can give the following idea a try. I make no guarentees that it'll work, but it should work for you...
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/RTPConnector.html]
    That example is an example of a "custom transport layer" for RTP connections. Essentially, it's some code that's handed the RTP packets on the transmission end, and it's expected to deliver those RTP packets on the other end. And it doesn't care about how they get from A to B, only that they do.
    If you were to replace the UDP socket in that example with a TCP socket, you would be guarenteed not to drop packets due to network reasons. Every RTP packet you were handed by the transmitter, you would then hand to the receiver. There is no guarentee that none of the packets would be cast away as "old" by the RTP protocol itself, but there's also no guarentee any of them would be. It's a crap-shoot at best, but it's certainly worth a try.

  • Junk Characters in the output XML file after Parsing

    Hi
    I am using DOM parser to parse an XML file.
    After parsing the input XML file, i am fetching some contents
    from the same and also putting the same contents in the parsed output file which is also an XML file.
    The problem here is that the after putting the contents to the output XML file from the input XML file,
    some junk character appears at the end of each and every tag in the outputfile.
    The junk character is some thing like this : " ampersand hash thirteen and a semicolon "
    (*THE MESSAGE DID NOT ACCEPT THE SYMBOLS KINDLY TRANSLATE THE ABOVE WORDINGS*
    INTO SYMBOLS)
    This character gets appended at the end of each and every tag in the output file due to which the output file
    is not recognised as an XML file.
    Please let me know as to why is this character appearing and also please suggest some solution
    for the same.
    -Thanks in Advance.
    Edited by: itskarthik on Oct 10, 2008 7:16 AM
    Edited by: itskarthik on Oct 10, 2008 7:18 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM

    Wierd.
    Try this piece of code. (You can always change it to use input file and output file instead of string if you want)
    What is your output?
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    public class XMLTest {
         public static void main(String[] args) throws Exception {
              String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
                                  "<test>\r\n" +
                                  "</test>";
              System.out.println("Input:");
              lookForCR(input);
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document doc = factory.newDocumentBuilder().parse( new ByteArrayInputStream(input.getBytes()) );
              Source source = new DOMSource(doc);
              ByteArrayOutputStream bArrOut = new ByteArrayOutputStream();
              Result result = new StreamResult( new StripOutputStream( bArrOut ) );
              Transformer xformer = TransformerFactory.newInstance().newTransformer();
              xformer.transform(source, result);     
              System.out.println("\nResult:");
              lookForCR(bArrOut.toString());
              System.out.println("\nDone");
         public static void lookForCR(String input) throws Exception {
              char[] chars =input.toCharArray();
              for ( char chr : chars ) {
                   if (chr == 13 ) {
                        System.out.println("Has 0x0D character!!");
    class StripOutputStream extends OutputStream {
         OutputStream out = null;
         public StripOutputStream(OutputStream out) {
              this.out = out;
         @Override
         public void write(int b) throws IOException {
              if ( b != 13 )
                   out.write(b);
    }- Roy

Maybe you are looking for

  • HP Printer will not print in black

    I have a MacBook Air. A couple days ago, my HP OfficeJet 6500 Wireless completely stopped printing black ink. The print cartridge is full, and we even took it out, put it back in, ran the diagnostic tests, cleaned, etc. The printer DOES print text in

  • Using FOP from Oracle PL/SQL

    Hello, I'm trying to use Oracle XML DB features in order to get a PDF document and Apache FOP is a very good tool. Can anybody give some code example about FOP from an oracle database (10g) ?? Thanks... Lionel

  • Video playback error qp1001

    I am trying to watch uverse on my ipad and get error of video playback could not be started.  Library Manager not started QP 1001.  How do I fix this?

  • Wlc 4402 errors when trying to join ap

    Hello, I have a wlc 4402 controller with software version 6.0.199.4 now i have problems adding 1131 aps to my controller. in the pas i added 15 access points (withouts problems) but now doesn't seems to work anymore. here's what i got from controller

  • Officejet pro 8600 Premium pick motor stalled error message

    I have the Officejet Pro 8600 Premium printer. I'm getting the message "pick motor stalled" after two and a half months of stellar use with this printer. There is no paper/print jam. I'm using the same paper I have always used. Help, is this a proble