How can I Read/write a ascii file?

How can I Read/write a ascii file? like this:
101     0.0000     -1.0000 +
102     -0.1887     -0.9485 +
103     -0.3578     -0.8639 +
104     -0.5022     -0.7516 +
105     -0.6177     -0.6177 +
106     -0.7018     -0.4689 +
107     -0.7533     -0.3120 +
108     -0.7723     -0.1536 +
109     -0.7603     -0.0000 +
110     -0.7198     0.1432 +
111     -0.6543     0.2710 +
112     -0.5682     0.3796 +
113     -0.4660     0.4660 +
114     -0.3531     0.5284 +
115     -0.2345     0.5660 +
116     -0.1152     0.5791 +
117     -0.0000     0.5689 +
118     0.1069     0.5375 +
119     0.2020     0.4876 +
120     0.2823     0.4224 +
121     0.3457     0.3457 +
122     0.3911     0.2614 +
123     0.4180     0.1732 +

import java.util.*;
import java.io.*;
class BallB{
     public static void main (String args [])
     throws Exception {
          String str=" ";
          String myString="";
          try {
            FileReader fr = new FileReader("test.txt");
            BufferedReader br = new BufferedReader(fr);
               FileWriter fw = new FileWriter("test1.txt");
               while(str!=null){
                    myString = str+"\n";
                    str = br.readLine();
                    fw.write(myString);
               br.close();
               fw.close();
          }catch (Exception e) {
               e.printStackTrace();
}

Similar Messages

  • How can I read the printer snapshot file printers.xml

    How can I read the printer snapshot file printers.xml

    XML files are typically viewed using a web browser.
    Open the XML file and the default program should open it automatically.  If you are prompted to select a program, use the option that lets you choose a program and brows through the directories for your browser (for example, use Internet Explorer, Firefox, etc.).
    If need be, you should be able to right-click the file and select open with to choose the program to open it with.
    There are other XML viewers out ther, but web browsers are typically the default as XML is a web language.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • How can I read/write data files (text file) from PL/SQL Script

    I had an oracle forms pl/sql program to read/write a data file (text file). When this code is run on a command line as a PL/SQL script using the SQL*Plus I am getting an error:
    -- sample.sql
    DECLARE
      vLocation                 VARCHAR2(50)  := 'r:\';
      vFilename                 VARCHAR2(100) := 'sample.dat';
      vTio                   TEXT_IO.FILE_TYPE;
      vLinebuf               VARCHAR2(2000);
      vRownum               NUMBER        := 0;
      -- use array to store data FROM each line of the text file     
      TYPE           array_type IS VARRAY(15) OF VARCHAR2(100);
      vColumn      array_type := array_type('');
      PROCEDURE prc_open_file(p_filename IN VARCHAR, p_access IN VARCHAR2) is
      BEGIN
        vTio := TEXT_IO.FOPEN(vLocation||p_filename,p_access);
      EXCEPTION
        WHEN OTHERS then
          --  raise_application_error(-20000,'Unable to open '||p_filename);
          message(sqlerrm);pause;
      END;
      PROCEDURE prc_close_file is
      BEGIN
        IF TEXT_IO.IS_OPEN(vTio) then
           TEXT_IO.FCLOSE(vTio);
        END IF;
      END;
    BEGIN
      --extend AND initialize the array to 4 columns
      vColumn.EXTEND(4,1);
      prc_open_file(vFilename,'r');
      LOOP
          LTEXT_IO.GET_LINE(vTio,vLinebuf);
          vColumn(1)  := SUBSTR(vLineBuf, 1, 3);
          vColumn(2)  := SUBSTR(vLineBuf, 5, 8);
          vColumn(3)  := SUBSTR(vLineBuf,10,14);     
          Insert Into MySampleTable
          Values
            (vColumn(1), vColumn(2), vColumn(3));
          EXIT WHEN vLinebuf IS NULL;
       END LOOP;
       prc_close_file;
    END;
    SQL> @c:\myworkspace\sql\scripts\sample.sql;
    PLS-00201: identifier 'TEXT_IO.FILE_TYPE' must be declaredIt works on the oracle forms but not on the SQL*Plus. Is there an alternative method using a PL/SQL script? A simple sample would help. Thanks.

    Did you ever noticed the search box at the right side of the forum?
    A quick search (limited to this years entries) brought up this thread for example
    Re: UTL_FILE Examples

  • How can i read Thai language in file .txt?

    AttN; Whom may concern.
    How can i read file txt in other language (Asian language such as Japanese, Thai, or Korea)?
    Please let me know urgent... I have to use it urgently...
    Best Regards,
    Sae
    Solved!
    Go to Solution.

    Hello Sae,
    Welcome to the Sony Community.
    What is the model number of the Reader Digital Book?
    The Reader supports the text file (.txt) formats as well as the following two formats:
    - EPUB file (.epub) EPUB (OPS version 2.0) supported
    - PDF file (.pdf) Support is based on the PDF 1.6 specification.
    The default language setting on your Reader Digital Book does not affect the language the book is in. To read books in a foreign language, you will have to purchase them specifically in that language.
    Thank you for your post.

  • How can i read data in pagemaker file (PMD) using Visual Studio C# NET ?

    I have bunch of data in .PMD file (Page Maker Document). Which contains mathematical equations and chemistry formulas, I am a .NET developer, and I am writing code for one of the educational learning system. For that I need to read and store mathematical equations/ chemistry formulas from .PMD file into database then display on the browser page.
    Is it possible to read data from .PMD file using C#.NET, do I need to use any external libraries. How can I import .PMD to MATHML (Mathematical Markup language)?
    Any existing examples for C#.NET?
    Please help me regarding this.

    I can't claim to know much about visual C# Net, but I do know a bit about pagemaker. It really can't handle equations. there are a few work arounds involving things like baseline shifts and multiple text boxes, but generally equations were created in different programs and placed in pagemaker in picture or eps files. Either way the chances of extracting usable data out of pagemaker is very slim.
    Jay

  • How can I read in a TDMS file into Sound and Vibration Assistant

    I have recorded a signal from 2 channels from a PXI 4496 DAQ card. I recorded this signal with the TDMS file format from a VI in Labview. I would like to import these signals into the Sound and Vibration Assistant for freq. analysis. In sound and vibration assistant there is an import logged tdms from signal express but I can not seem to import my original signal?  How can I import this data? 

    Hello All,
    I am trying to read TDMS file using LABVIEW. The TDMS file is created by me for reading data from one wire devices.
    I have created simple vi. attached below which read data from TDMS file. I am able to read other tdms files, I have with this program but not which one created by me. I am not able to attach file with .tdms exentiont. So I have attached it with .xlsx extention. Can anyone please guide me where is the problem in TDMS file? Am I missing anything while creating it?
    Thanks
    Attachments:
    EditTDMS (1).vi ‏14 KB
    data.xlsx ‏17 KB

  • How can i read my 1080 50p files from my panasonic camera

    Hi all newbie here can someone give me the name of software that can read my panosonic HDC-HS700 1080-50p files from my camera i can read the HA 1920 files okay but just cant read the 1080 file, people tell me that the imac doesnt support the 1080-50p files but surely there must be some software that can read from my camera.
                 Regards to all Pete.

    Hi  EZ  Jim, 
    After reading and following the info you sent through, i realised that the question i asked was totally wrong.
    my question is that my mac cant read or even see the 1080/50p on the hard drive of my cam, because apparently the Panasonic HDC-HS700 is not compatible with Apple can you beleive that, so now i have got to go out and by the software from Panasonic install on a crappy windows machine and then onto a portable hard drive and then back into my Mac.what a load of c--p.
    So thanks EZ for your help it was in any event usefull info that you gave me,
    My very Best regards Pete.
    EZ Jim wrote:
    You're welcome.
    We will watch for your status update.
    (Hope you and Fido have a nice walk! )
    Message was edited by: EZ Jim
    Mac OSX 10.8.3

  • How can I read my iPhone backup files?

    I would like to have a readable version of my text message backup files. I have found the file but I can't read it in its current database format. Please help!

    Why not read them on your phone? Or if the screen's too small for that to be comfortable, email them to yourself and read them on the Mac.

  • Pls How do I read/write a xml file using java

    I want to read/write trough a server/client a file.xml from evt. the same computer, this is the code for the client
    import java.io.*;
    import java.net.*;
    class client
    public static void main (String args[]) throws Exception
    final String msg = "<beg>note</beg>";
    // BufferedReader in = new BufferedReader(new FileReader("note.xml"));
    final Socket clientSocket = new Socket ("localhost", 8000);
    final OutputStream clientStream = clientSocket.getOutputStream ();
    clientStream.write (msg.getBytes ());
    // clientStream.write (in.getBytes ());
    clientSocket.close ();
    // BufferedReader in = new BufferedReader(new FileReader("note.xml"));
    // System.out.println(in.readLine());
    I want to read it and put it in a buffer...
    please somebody help me!!!
    regards
    Harry

    Pls read this:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=271751
    And don't post the same message twice. It's annoying.

  • How can Java read VC++ serialized achieve file

    After finally realizing Java is much more powerful than C++, I am currently transferring my VC++ codes to Java and having a problem on how to read my old VC++ serialized achieve files. In java.io, can readObject() do the same job as VC++'s Serialize(ar)?
    In VC++ codes, my data was structured as the following:
    struct TickData {
         time_t     time;
         double     price;
         int     size;
    CList<TickData, TickData &> m_tickList[TICKER_MAX];
    m_tickList[nId].Serialize(ar); // VC++ data was saved this way
    Does anyone know what java method and how I should use to read all my old VC++ serialized files?
    Help on this will be greatly appreciated! Thanks.

    Unless you find some library somwhere, I strongly suggest to write a conversion tool in VC++.
    It takes a serialized file as input and spits out a file in a language independent format: XML,
    CSV, INI, Java properties, whatever. You Java program will use this format, not serialization,
    so you will never have this kind of problems in the future.

  • How can I read content from PDF file stored in Oracle 9i XMLDB

    Hi Friends:
    Now I have met one question that I don`t know how to read some String , for example "Hello", from the PDF file stored in the Oracle 9i XMLDB, I have stored that PDF file into the XMLDB now, any suggestions are appriciated . Thank you in advance.

    You may be able to do something with Oracle Text. The following shows how to get an HTML rendiditon of a binary document. I think you can also get plain text instead of HTML
    set echo on
    spool xfilesUtilties.log
    connect sys/&1 as sysdba
    grant ctxapp to &2
    connect &2/&3
    begin
      ctxsys.ctx_ddl.create_policy(policy_name=>'XFILES_HTML_GENERATION', filter=>'ctxsys.auto_filter');
    end;
    create or replace package xfiles_internal_11010
    authid definer
    as
      function renderAsHTML(sourceDoc BLOB) return CLOB;
    end;
    show errors
    create or replace package body xfiles_internal_11010
    as
    function renderAsHTML(sourceDoc BLOB)
    return CLOB
    as
      html_content CLOB;
    begin
      dbms_lob.createTemporary(html_content,true,DBMS_LOB.SESSION);
      ctx_doc.policy_filter(policy_name => 'XFILES_HTML_GENERATION',
                            document => sourceDoc,
                            restab => html_content,
                            plaintext => false);
      return html_content;
    end;
    end;
    show errors
    create or replace package xfiles_utilities_11010
    authid current_user
    as
      HOME_FOLDER   constant varchar2(700) := xdb_constants.HOME_FOLDER;
      PUBLIC_FOLDER constant varchar2(700) := xdb_constants.PUBLIC_FOLDER;
      function renderAsHTML(sourceFile VARCHAR2) return CLOB;
      function transformToHTML(xmldoc XMLType, xslPath VARCHAR2) return CLOB;
    end;
    show errors
    create or replace package body xfiles_utilities_11010
    as
    function renderAsHTML(sourceFile VARCHAR2)
    return CLOB
    as
    begin
      return xfiles_internal_11010.renderAsHTML(xdburitype(sourceFile).getBLOB());
    end;
    function transformToHTML(xmldoc XMLType, xslPath VARCHAR2)
    return CLOB
    as
      html clob;
    begin
      select xmldoc.transform(xdburitype(xslPath).getXML()).getClobVal()
        into HTML
        from dual;
      return html;
    end;
    end;
    show errors
    grant execute on xfiles_utilities_11010 to public
    create or replace public synonym xfiles_utilities for xfiles_utilities_11010
    quitMessage was edited by:
    mdrake

  • How can i read comments from properties file in the right order??

    Hello
    I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file.
    But the problem in using the properties class that it doesn�t read the comment and not save the properties in their order so I can�t couple description and name of the property.
    Does any one know any utility that do the job or know how to solve the reading the comments problem???
    Thank you a lot?

    sorry but i dont understand how the solution of using
    a dot ( property_key.description ) helping me to
    solve the problem?
    please try to explain it agin.
    thank youYou wrote:
    "I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file."
    So i'm as developer imagine that somebody edit properties in GUI or console. So you have 3 text fields: property name, property value, and propety description. Then developer save edit changes, then text fields maped to properties file and:
    text field "property name" and text field "property value" construct property:
    name=valuetext field "property name" adding ".description" and text field "property description" construct property:
    name.description=descriptionFor one described property, you will have put two properties.
    Thanks!

  • Its urgent. Pls guide me. How can i read .msg or .eml file

    Hi,
    I am in very urgency in solving a problem. pls help me. I am working on a j2ee application. In that user recieves mails, he stores them using outlook or outlook express in .msg or .eml formats. Now from that folder i have to read the contents of that mail and present on a jsp page. Can i do that? pls suggest how to.

    double/crosspost
    http://forum.java.sun.com/post!reply.jspa?messageID=3562649

  • How can I read a file with ASCII Special Character into a SQL table using SSIS 2008?

    I've tried everything to read this file and am getting no where.   Help how can I read this file and load a SQL table?
    RS - AscII - 30  (Record Separator)
    GS - AscII - 29 (Group Separator)
    Thank you for your assistance - Covi
    Mark Covian

    We can use script component as source/transformation to read the text file and assign the contains to a string. Split the string by chr(30)  i.e RS and finally stored into an array or write to the output buffer of the script component.
    For example on how to use script component refer this link
    http://social.technet.microsoft.com/Forums/en-US/6ff2007d-d246-4107-b77c-624781baab38/how-to-use-substring-in-derived-column-in-ssis?forum=sqlintegrationservices
    Regards, RSingh

  • Using Lab view ver 6,How can I read a cell of excel file right after I write to it

    How can I read a specif cell of an Excel file using Labview VI.

    Hi,
    Attached is a LV6.1 VI which will read a cell.
    It will be looking for a sub VI found in the example C:\Program Files\National Instruments\LabVIEW\examples\comm\ExcelExamples.ll​b.
    The returned value is a string value but there is no reason why it couldn't be a number. Just connect a numeric to the type connector of the Variant to Data function.
    Hope this helps.
    Regards
    Ray Farmer
    Regards
    Ray Farmer
    Attachments:
    Get_Cell_Value.vi ‏41 KB
    Write_Table_To_XL.vi ‏101 KB

Maybe you are looking for

  • Private key password for Default DemoIdentity Keystore?

    Hi I am trying to Configure SSL in ALSB. I have created the PKI Credential mapping for the Default DemoIdentity Keystore But it is asking for the password to access the Keypair. The document states that i need to provide the password set during the c

  • When importing text into a slide and it overflows how do you see what is not on the screen

    When using keynote and importing text that overflows the slide how do you see the text not on the slide so that you can cut and paste to next slide

  • Using iWeb to publish to different services

    I have iLife 2008, and I also use a dot-Mac account. I want to publish a handful of different web-sites for different organizations. One organization would use the dot-Mac account. Another uses a separate web server that has nothing to do with dot-Ma

  • Process is running  in sm50

    Dear All, In sm50 i see one process is running from last 2 days. running        Yes           SAPLTHFB But in sm37  there is no process running. Please guide. Thanks & Regards Kumar

  • Planned Cost in PS which are maintained in HR

    Hi, In project systems, For calculating the Planned Cost I require Employee Gross Salary which is maintained in 0008 Infotype, in Employee master data (PA30) How to get the Gross amount to PS for Planned Cost Can any one help me by providing integrat