Reading And Writing file

Hi,
i want to insert some lines of text some where in the text file
can do it using only one file?
Plz Help Me

No.
Yes, but I'll be charging you $85 per hour for the consulting work.
This is a horrendously simple thing to do. Have you done a web search for code examples?
Can you spell the wordl "please" if I gave you $10? How about the word "you"? Do you know what a questino mark is?
Man...I'm getting sick of these people!

Similar Messages

  • Quickest method for reading and writing files

    Hi
    I need help regarding file operations.(Reading and Writing). Currently I am using BufferedReader and BufferedWriter to read and write files. But the files (XML) are very huge files(from 30 -50 mb). This is slowing the application to a great extent. Is there any other approach to perform the above mentioned operations on XML files in a fast manner.
    Thank You
    Mansoor.

    Hi
    Can u let me know how to use the java.nio pavkage for primitve data types(int,float..., boolean). I have tried it but found no success.
    Thank You
    Mansoor

  • Reading and writing files in Mac OS X

    Hello, I am "kind of" experienced with Java (read a few books, and took one course in highschool, and I fool around with it from time to time).
    All of this however was on Windows XP, and all from the command line. Because I now have a Macbook Pro, I wish to start programming java on Mac OSX naturally. I've gotten over the shock and awe of using Xcode (I had never use a "package" before with multiple components), but I have come across a problem. I referenced one of my Java books on how to read from a .txt file (my intended program needs a database), but I've been trying for a few hours now, and I just can't seem to get it to work at all.
    I want to read the entire file and save it as a String. I don't know if there is a different procedure on OSX than Windows, but here is what I am using:
    import java.io.*;etc. etc.
    public String readPlease() {
         String str = "";
         try {
              FileReader file = new FileReader("database.txt");
              BufferedReader buff = new BufferedReader(file);
              str = buff.readLine();
              buff.close();
              return str;
         } catch (IOException e) {
              return e.toString();
    }And it is returning:
    java.io.FileNotFoundException: database.txt (No such file or directory)The .java file and the .txt file are in the same folder (src) and I've tried it while its in "resources" and "bin" (where the .class files are).

    That file needs to be in the directory that you launch your program from.
    Is that where it is? It might help if you showed us the command you are using to execute and where you are relative to your file etc.
    Also this
    BufferedReader buff = new BufferedReader(file);
    str = buff.readLine();
    buff.close();is going to only read one line of the file. Do you know that?
    If you want to read multiple lines you'll need a loop, and you should be using a StringBuilder and appending to it to build your String. Then you can call toString on the StringBuilder instance once at the end to get your string.

  • Reading and Writing files to external controller with Agilent 4395A

    Hi everyone,
    I have been trying to store the Agilent 4395A Analyzer Compensation Files in an external controller, and then writing them back into the 4395A while running a program. I'm doing this because the 4395A's internal memory and disk storage are not large enough to store all the files I need. I know that the files are binary, and that they can only be read 16kB at a time (the maximum dump by the analyzer). I also know that each dump comes with a specific header that describes how long the dump is.
    My problem is that when I read the files, I believe that something is being corrupted - either by the internal workings of LabVIEW or something in my program. In particular, I notice that when I attempt to use the "Write to Binary File" vi something is being added to the file that I had not intended. At the beginning of the file I notice the string of characters "  @" being added. I know that the analyzer is not giving me these characters so I suspect that LabVIEW is adding them somehow.
    If anyone has any idea about where these extra characters may be coming from, or if you have previous experience with the read/write with the 4395A, any suggestions would be appreciated.
    I have attached an image of the program which saves the files. It is pretty simple, and the only spot where data is actually being read is in the while loop.
    Thank you!
    Matt
    Attachments:
    4395A_SaveFile.jpg ‏2287 KB

    Changing the extension of a bitmap file to get around the prohibition of posting them, is really inappropriate behavior. Use paint to save them as either jpg or png.
    Your problem is probably because the default behavior of the Write to binary File is to prepend array or string size. This is an input to the function and is explained in the on-line help. Turn on Context help and click on 'Details'.

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled.

    I have duplicated a project to work on another computer. The project opens fine but when I import new footage/audio files I get this message. "File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled." Then I can't play my timeline and Premier Pro crashes.  I have to force quit and restart my computer to continue working. What does this error really mean? How do you rectify?
    Our workflow requires that we duplicate projects to make updates because we are frequently revising but need to keep original project unchanged and intact.

    I have a similar issue and message , but occurs when I import AVI clips from OnLocation CS4 to Premier Pro CS4.

  • IPhone4 how through the USB mobile phone file reading and writing?

    iPhone4 how through the USB mobile phone file reading and writing?

    No idea what you are asking.
    Please explain

  • Reading and Writing large Excel file using JExcel API

    hi,
    I am using JExcelAPI for reading and writing excel file. My problem is when I read file with 10000 records and 95 columns (file size about 14MB), I got out of memory error and application is crashed. Can anyone tell me is there any way that I can read large file using JExcelAPI throug streams or in any other way. Jakarta POI is also showing this behaviour.
    Thanks and advance

    Sorry when out of memory error is occurred no stack trace is printed as application is crashed. But I will quote some lines taken from JProfiler where this problem is occurred:
              reader = new FileInputStream(new File(filePath));
              workbook = Workbook.getWorkbook(reader);
              *sheeet = workbook.getSheet(0);* // here out of memory error is occured
               JProfiler tree:
    jxl.Workbook.getWorkBook
          jxl.read.biff.File 
                 jxl.read.biff.CompoundFile.getStream
                       jxl.read.biff.CompoundFile.getBigBlockStream Thanks

  • Very slow painting while reading and writing doubles into file

    for 15MB length file i = 7662080
    for 50MB length file i = 12414368
    Part of Code for writing into file follows like this:
    try{
    fos = new FileOutputStream("Angel.txt");
    File f = new File("Angel.txt");
         if(f.length() >=4)
         f.delete();
    fos = new FileOutputStream("Angel.txt");     
    dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
    int x=0;
    double y_last, y_new;
    for(int j=0 ;j<i ;j++)
    if(some condition)
    y_new = ....;
    try{
    //previously in vectors
    y_last = y_new;
    vect.add(new Line2D.Double(x, y_last, x, y_new)_;
    dos.writeDouble(y_new);
         }catch(Exception e){System.out.println(e);}
    dos.close();
    fos.close();
    x++;
    }catch(Exception excp){System.out.println(excp);}
    part of code for reading from file follows like this:
    public void paint(Graphics g)
    try{
         double y1, y2 =0;               
         Line2D.Double doub;
         raf = new RandomAccessFile("Angel.txt","r");
         dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
         raf.seek((rect.x*8));
         for (int i = 0/any value; (i < value as per choice); i++)
              g2.setStroke(new BasicStroke(0)); //2
              y1 = y2;
         y2 =dis.readDouble();
              doub=new Line2D.Double(i,y1,i,y2);
              g2.draw(doub);
    dis.close();
         raf.close();
    }catch(Exception excp){System.out.println(excp);}
    I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
    are not serialized.
    Any idea to make reading and writing into file specially from MB files faster is appreciated.

    Why are you reading in the file in the paint method ?
    Create your data once before painting.
    I think you should explain what is your goal and what behavior you want.
    Denis

  • How to read and write files using flex?

    Using flex, we would like to make some utility that will do a
    lot of reading and writing from local files.
    The writing is what I am more worried about. How is this
    possible?
    I want to make .zip files containing many xml files, and some
    assorted media files such as .swf jpeg, html, etc.
    I am new to flex btw, I've never used it properly before, and
    this is the main concern I have with flex, which is that it doesn't
    let me write and read lots of files.
    Mainly we are looking for a good cross platform solution that
    will let us develop an app, and flex looks professional and it is
    cross platform. The "internet app" side of things, isn't so much
    what we need really.
    Would wxWidgets be better suited to our needs?

    The Flash player sand box will not allow reading and writing
    local files. If you want to use Flex to create a desktop you will
    need the Apollo runtime. The alpha is available at Adobe
    Labs.

  • Reading and writing a ByteArray

    This question was posted in response to the following article: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7d54.html

    I believe that the example of Reading and Writing Objects needs a rewrite
    First, the attempt to use comments to interleave a Flex-ified example with a Flash example of the uses of the ByteArray Class is a shortcut that ultimately fails.  Take the time to create two, separately valid examples for the two different frameworks.
    Second, the interlinea comments show a rather poor example of how to write clean code, and are entirely confusing to the person you you trying to help learn how to use your library.  Look at the declaration of a variable called outFile:File, a comment about some function that is to be declared somewhere with the same name, outFile(), and indeed, if this code were to compile -- which I am sure it could not -- the compiler would see that you try to invoke an outFile() function.  No one gets through an interview who writes code that way.
    Third, I am not sure you understand how the readBytes and writeBytes methods work. In the upper example, where an order is being written to the file system, the writeBytes method uses data.length correctly.  At the point in time that it is used, the XML object will have been written into the bytes:ByteArray, so it will have a proper length.
    On the other hand, in the second half of the example, where the readBytes method similarly passes data.length, the reader has to be very lucky to note that at that point in time data.length will have a value of zero.  The inBytes:ByteArray was only instantiated, not populated with anything, as, indeed it should not be, at that point in the logic flow.  Most importantly, when the program does need to readBytes, there is no way for the program to know in advance what the length of the byte stream coming in from the file system will be.  Your example would be more correct, and could make a useful point in showing that readBytes (data) is the correct way to pass the arguments because the default behavior will then be used and the default behavior will be to make data whatever length it needs to be in order to hold the content from the file system.  The program can know the value of data.length after the read has taken place, but not before.

  • When will Apple have a searchable text reader and upload file capability?

    When will Apple have a searchable text reader and upload file capability? I have a large text file I need to upload to my iPhone, search, and dial.
    Anything planned?

    I had a Palm the I used for work and travel it had a very nice application called DOCUMENTS TO GO. It allowed you to upload, view, and edit .doc, .xls, and .ppt files. this was very handy when traveling. Also, I could sync my palm with my iMac and work PC using bluetooth, took care of the file transfers as well. I would like to have the same capability on my iPhone. I bought it to replace all of my old stuff i need it to the same as my old stuff. I hope that Apple reads this and gets on the ball. Until then I still have to carry my Palm or thumb drive on trips.

  • Grant an account rights to read and modify files in all Redirected Documents folders?

    We have set up redirected Documents folder with the default recommended permissions that does not grant Administrators any access to the folders.  If an administrator needs access to a folder, they take ownership of the folder, grants themselves permissions
    and does whatever they need to do with the folder such as delete it or give access to a new person.  This is rarely needed so it is not a big deal.
    However,  we  now need to import everyone's Outlook PSTs (stored in their redirected MyDoc's so they are backed up) into their new  Exchange Archive mailboxes.  We will also need to be able to verify all PSTs are gone from the file server
    once the contents are imported into their archive mailbox.  We also need to be able to run reports showing which users are storing music and video files in their folders and how much.
    When I tried to run Windirstat against the share containing the redirected MyDocs folders to see what file types where taking up space, I got very incomplete results even with using psexec running as system account due to inadequate permissions on the user's
    folders.  
    We also need  the PST Capture Tool to have rights to read into their documents folders and move any psts found into the users archive mailbox.
    Rather than having to go to each user's redirected documents fiolder one by one and take ownership to change permissions, is there a more efficient way to have an account running the PST Capture Tool and WindirStat have access to read and change files in
    the user's redirected documents folders?
    I thought of just removing the option in the GPO that says "Grant the user exclusive rights to My Documents," but I don't think that will work on pre-existing
    folders that already have permissions set.

    Hi,
    Based on my research, if you already have a bunch of existing redirected My Documents folders set up with the
    Grant the user exclusive rights to My Documents check box selected, the only documented way to regain access to the folders is to take ownership of each individual folder and manually edit the permissions to give the Administrators group full
    control.
    We can use powershell script to help regain access to the folders, for more details, please go through the below link:
    http://mypkb.wordpress.com/2008/12/29/how-to-restore-administrators-access-to-redirected-my-documents-folder/
    Regards,
    Yan Li
    Regards, Yan Li

  • I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, re

    I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, reinstalled still have same issue.

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • Switcher - Reading and Writing External IEEE HDD's

    Greetings,
    i'm trying to read and write with my external ieee drive on windows and the mac pro. it's format is ntfs, and is read only on the mac pro.
    i am admin and can't seem to change the permissions to read / write.
    the over all idea is i need to go back and forth between operating systems reading and writing from both sides of the house.
    here's a snapshot.
    http://briankross.com/images/500GBIEEEHDD.jpg
    Mac Pro   Mac OS X (10.4.8)  

    Unfortunately, no. In order to convert the drive to FAT32 it must be re-partitioned which is a destructive process.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

Maybe you are looking for

  • If i update Itunes, do i have to re-add all the songs?

    If i update to the new version of itunes, do i have to readd all the songs? Just that i have changed the attributes of many of the songs (28GB in total) such as track names, album names and so on that would take me forever to re-do. Cheers Dave

  • IN clause with ORDER BY clause in sub-queries

    Hello, We generate dynamic queries with the following statement pattern (could be many union/intersect sub-queries): select my_col from my_table where my_col IN select table_2.my_col , x_col from table_2 where x_col > 10 UNION select table_3.my_col ,

  • Cannot add static routes wrt350n

    Router has latest firmware and was just set to default values. I cannot add a static route, says "static route invalid" no matter what address I input (keeping it simple, trying 192.168.1.XXX) I have never had this problem with any other router and I

  • HRMD_A IDocs in Error Status 02

    Dear SAP Peeps, Upon generation of outbound HRMD_A idocs, an error occurs. Error status is "02 - Could not find code page for receiving system". Can you guys assist me here? What does code page mean? How the error will be solve? The error occurs in e

  • Candidate Search has no results (No Data Available)

    Dear Experts, Running the "Candidate Search" I always get the "No Data Available" message. The point is I have some candidates availabe and I've run the RCF_CHECK_SEARCH_SETTINGS report with no errors. I also have run the KPro diagnosis test for docu