How to store data in the text line by line?

when i write the data into *.txt, the data I wrote before is deleted.
how can wrote the data into the txt following the existing data?
how to write data line by line? many thanks!
my code is like:
private String text = "i am yanbo du, i am a boy.";
public BufferWriteMultiKey( ) {         
     try {
          StringTokenizer st = new StringTokenizer(text, " ,.");
          File fil =new File("f.txt");
     //FileWriter fw = new FileWriter(fil);
     //BufferedWriter bw= new BufferedWriter(fw);
     DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fil)));
while(st.hasMoreTokens())
String s = st.nextToken();
     //bw.newLine();
     out.writeChars(s);
out.writeChars("\n");
out.close();

use a random access file and append text at the end.
read the file in line by line using a BufferedReader and store each line in a List of Strings, of course.
%

Similar Messages

  • Store data in the cloud

    How to store data in the cloud ?

    If you are referring to iCloud, the information on this portion of Apple's support site should help for starters:
    http://www.apple.com/support/icloud/
    I'd suggest you start with the "getting started" section. If after reading that and any section pertaning to the type of data you wish to store you still have specific questions, post back and someone can probably help.
    Regards.
    Message was edited by: varjak paw

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • Hi, I am using USB 8476s to communicat​e to a slave unit in LIN network using LabVIEW7.1​. Can anyone tell me how i can send a header file plus 1 byte of data to the slave in a LIN network. or how do i use ldf file. i want to read responses from the slave

    Hi,   I am using USB 8476s to communicate to a slave unit in LIN network. Can anyone tell me how i can send a header frame plus 1 byte of data to the slave in a LIN network. or how do I communictae with slave using LabVIEW7.1.
    I want to read responses from the slave. When i tried with labview exapmle programs or even using MAX also, while doing some switching action in my slave, i am getting response as Device inactive with timestamp but there is no data format. 
    And I have Lin Description File. Can you suggest me how to use ldf file.
    I am at customer place and It would be great help from you if you can suggest me at the earliest. Thank you

    you may use the LDF Starter Kit to use LDF informations in your application
    http://joule.ni.com/nidu/cds/view/p/id/665/lang/en

  • Many messages are showing up randomly on my mail.they say no message and no sender and give very strange dates.  The text is gray - I can't delete them. What is this?

    Many messages are showing up randomly on my mail.  They say no message, no sender and have strange dates.  The text is gray; I cannot delete them.  What is this?

    The Best Alternatives for Security Questions and Rescue Mail
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contacting Apple for
            support and service.
        c. Rescue email address and how to reset Apple ID security questions

  • I did a COPY of some text from a web page, and then did a PASTE into notepad.exe (Windows). The text from each line was duplicated -- on the line! Instead of "Fred", it became "Fred Fred".

    I just recently installed Firefox for the first time. It seems nice and quick. The version is reported as: "10.0.1".
    I wanted to save some text from a web page, so navigated to that page, selected the text, and pressed the Control-C combination to COPY the selected text to the buffer. For example, the text I selected looked something like this:
    Harry
    Ron
    Hermione
    Hagrid
    Albus
    NOTE: Each line of text has a small icon to the left of the text.
    It is not reasonable to COPY and PASTE each line individually, as there can be hundreds of lines of data. I recall, however, that
    doing a COPY and PASTE on this data into Microsoft's Excel will produce cells which have the icons included in the cell, but unfortunately one cannot can't get rid of them! At least I've never found a way to remove them, but that's another issue. :)
    Once I'd done the COPY operation I switched to a Notepad window and did a PASTE operation. To my surprise, the text from each line was duplicated. It looked like this:
    Harry Harry
    Ron Ron
    Hermione Hermione
    Hagrid Hagrid
    Albus Albus
    Thinking that there might be something unusual about the web page I looked at the source, but it appeared "normal" -- that is, as expected.
    Note: I have done this operation several times before, and have never seen this occur before.
    Note: In the actual data some of the lines have quoted text in them. Curiously there is weird behavior on these lines. In some cases the entire line is shown only once. (These occur at the top of the line, and the quoted text is at the beginning of the name.)
    When quoted text appears "later" in the name, in some cases the quoted text is duplicated, and in other cases the quoted text is missing altogether! I have also noticed an error with the quoted text, and so will be reporting that to the web site which generates the HTML.
    Note that each line of "text" is "anchor text", so if I click on a name the browser navigates to a page for that name.
    I believe that the problem is that the COPY operating in Firefox is not simply copying the visible text, but also the ALT=
    Below is a sample of what the source HTML looks like:
    <a class="lnk" target="_blank" href="http://details.aspx?id=Harry">
    <img width="16" height="16" alt="Harry" class="tb_icon" src="http://.../Harry.gif"/>
    <span>Harry</span></a>
    <br/>
    (Because of the true length of the lines in the source HTML, I have stripped out the actual URL of the site.)
    To make sure I wasn't imaging this difference I repeated the process within Internet Explorer. In that browser I did not get duplicated data.

    Try:
    *Extended Copy Menu (fix version): https://addons.mozilla.org/firefox/addon/extended-copy-menu-fix-vers/

  • How to store data (in tdm files)

    I'm looking for advice on how to store data in tdm/tdx files.
    The main challenge is like this: At regular time intervals there is new data available (say every 10 minutes there are 10 minutes of new data available). All data is time based. So every ten minutes I may create a new tdm/tdx file containing this data segment. However, when i want to analyze the data i dont necessarily want to view 10 minutes of data from all channels, but maybe 20 hours of data from one particular channel.
    The way I've achieved this so far is to manually load each 10 minute segment of this particular channel and then add these parts together. This is both time consuming and cumbersome. Is there a better way to do this that I've simply not discovered yet? Is there a better way to store data to simplify this process?
    One solution is of course to save data from several 10-minute frames in one file, but seeing as there is a never ending supply of data i cant simply save all data in one giant file, it has to be split up at some point, and the problem will still remain.
    One factor to have in mind here is that this is rather large amounts of data (maybe 10GB each day), so the option to simply load all the data into memory goes out the window rather quickly.
    Feel free to ask if I've not made myself very clear

    Hi salte,
    If your test ever ended, and if you had LabVIEW 8.20 or higher, I would recommend using a TDMS file, which handles data appeands flawlessly.  DIAdem 10.1 now also does data reduction and index windowing during file loading for TDM / TDMS / DataPlugin files, so that you could easily load out only the part of the file you wanted to look at.  But since you describe your data acquisition as never stopping and amassing 10 GB per day, I agree that it would be impractical to use only 1 data file.  So we are stuck with some number of files which each contain a part of your measurement.  This approach can have advantages, since you can save operational properties for each "buffer" such as average value, dominant frequency, ambient room temperature, etc., and later on you can use the DataFinder to query out only the data buffers which meet specific conditions based on these properties.  The problem remains to load and assemble data based on multiple files.  This is an old problem in DIAdem, and one for which I have an efficient and I hope satisfactory workaround application.  It does what you describe already doing in the minimum amount of time and with the minimum amount of user interaction, and it can be highly parametrized to suit your particular situation.  The ideal way to start the application would be as part of a ResultsList custom menu.  This would enable you to query out the buffers you wanted, highlight those rows in the ResultsList, right-click and choose your custom menu, and WHAM! the selected buffers for your queried channel(s) are automatically appended together in the DataPortal.  Launching from a ResultsList custom menu would mean that you could skip the file dialog and just read out the data sources directly from the ResultsList selection.
    Let me know what you think,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Importing Data from Multiple DataPlugin Files.zip ‏198 KB

  • How to store image in the oracle database 10.2. using File Maker 10.

    Hi.,
    I want to store image, media file in the oracle database using File Maker as a front end.
    I connect Oracle using odbc from file maker. There are table and in that table there a column "pict" of blob type. but this column is not showing in the file maker.
    2. Here I can not change the data type of any column.
    Now how to store images in the oracle table using odbc or any other tool.
    Regards,
    Shyam

    I wrote an example for my students, you can find it here. It's using PHP as the front end but all you need to do is know how and leverage the stored procedures. All code is downloadable in zip files from the blog.
    http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/

  • How to compare Date in the TextField or DateTime with Date/Time field?

    Hi All,
    I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
    My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
    The functionality of my form is:
    I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
    In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
    I have tried using Num2Date and Date2Num with "YYYY-MM-DD"  format to compare but not succeed!
    Can you guys help me in this? Thanks in advance
    Regards.

    Hi,
    Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
    Here is the code which I am assigning the value:
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
    Do I need to change the format while assigning value in text box?
    You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
    Regards.

  • How to store data for an account individually

    hi there, may i know how do u store data for an account individually.
    let's say i have an application for all users. but i do have a log in module since i have a module where users can enter thier own information into the system like appoinments. since every account( owned by user) has different details, may i know how to design such system?
    mus i store data in the local system instead of the database?
    thanx in advance

    let's say i have an application for all users. but i
    do have a log in module since i have a module where
    users can enter thier own information into the system
    like appoinments. since every account( owned by user)
    has different details, may i know how to design such
    system?
    mus i store data in the local system instead of the
    database?You can store all the information in the database you want and you can also retrieve it where ever and however you want.
    Exactly how to do it depends on exactly what you want to do, so plz explain alittle bit more on what do you intend to do. :)
    Gul

  • What is a cube? how we store data in that? how we fetch data from cube?

    Hi,
    What is a cube? how we store data in that? how we fetch data from cube?
    Regards.
    venkat

    >
    venkey B wrote:
    > Hi,
    >
    >
    > What is a cube? how we store data in that? how we fetch data from cube?
    >
    >
    > Regards.
    >
    > venkat
    Hi Venkat,
    I guess you mean an infocube from the SAP BI product. I propose to look at the forum for Business Intelligence to find your answers.
    E.g. SAP POS DM writes the sales data in infocubes.....

  • How to store data from textfile to vector and delete a selected row.

    Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
    Do someone has an idea? :)

    nemesisjava wrote:
    Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
    Do someone has an idea? :)What's the problem? What have you done so far? What failed?
    What you described should be pretty easy to do.

  • How to store data in JavaFX 1.2 Mobile with Storage and Resource API

    I'm need to store some numbers and strings in an application that will be deployed in a HTC HD2 device with JavaFX 1.2 When run on desktop, everything works perfectly. But after being installed in the device, the application won't store data in files. I thought JavaFX was able to do that, according to its documentation (http://download.oracle.com/docs/cd/E17802_01/javafx/javafx/1.2/docs/api/javafx.io/javafx.io.Storage.html)
    I do it like this (just the part that stores integers)
    public var availableGifts : Integer[] = [0,0,0];
    var highscoresFile = Storage {
    source: "AvailableGifts.txt"
    public function writeConfiguration() {
    try {
    var resource : Resource = configurationFile.resource;
    var outputStream : DataOutputStream = new DataOutputStream(resource.openOutputStream(true));
    outputStream.writeInt(availableGifts[0]);
    outputStream.writeInt(availableGifts[1]);
    outputStream.writeInt(availableGifts[2]);
    outputStream.flush();
    outputStream.close();
    println("Data stored!");
    } catch(ex : IOException) {
    ex.printStackTrace();
    The application is self-signed, just in case. But it won't store data in the mobile device... I need some help with this!

    Agh, the problem is not in how data is stored, because it IS being stored. The problem is that inputstream.available() seems to always return 0 in the mobile device, so the file seems to be empty.
    But that's a different problem.

  • How to store data in ipad from computer

    please explain me how to store data (music video & pictures) in  ipad from any personal computer...kindly explain me in simple steps...

    The iPad can only sync with one computer.  To do this you need to have iTunes installed on the computer and have it associated with your Apple ID.  you can then use iTunes to transfer music, movies and pictures from that computer, and that computer only.
    iOS: Syncing your data with iTunes
    http://support.apple.com/kb/ht1386
    If you need to get files from other computers, you would need a 3rd party App that can handle the formats you wish to transfer, and possibly transfer them either through iTunes file sharing or Wifi transfer depending on what the App supports.
    iOS: About File Sharing
    http://support.apple.com/kb/ht4094

  • How to copy and paste the text in Russian - 'command+c' erases it

    How to copy and paste the text in Russian - 'command+c' erases it

    I want to publish a book with Blurb. They don't have Russian fonts, so I have to type the text in Russian in Notes in my iPad, send it to my e-mail box, and then open the e-mail box in Mac, and copy and paste the text into the book template of Blurbs. I don't know how to make a Russian keyboard in Mac to be able to type quickly. I asked about it  in the Apple store, and they showed me how to find a Russian keyboard in the net, but it takes much time to type using a screen keyboard, and the texts also cannot be copied and pasted, when they are in Russian. They are erased when I press 'command+C", and all I have is a single letter 'c' instead. No problems with texts in English. Maybe Russian is not supported for copying and pasting?:(

Maybe you are looking for