Inserting text into a file

Hi all,
I don't know if my question has already been answered in former postings so excuse if it has.
I have a textfile opened as RandomAccessFile for read and write. Now I'm looking for a string in this file by this code:
do{
sText=fFile.readLine();
while (!(sText.equalsIgnoreCase("Information")));
Now I want to extend the String "Information" with "read=1" so the complete string is "Information read=1" and want to write this back in my File. Now I have two problems:
1. How can I replace the old "Information" in my file with my new string?
2. How can I prevent overwriting the following data?
Please help
Thanks in advance
Marko

I also thought copying the whole file into a string but this function is part of an often used class and the file's sitze may vary up to some megabytes with many "information" strings inside so this may cause problems.
Hello,
if this file isn't too big, I would prefer to load the
hole file in a string and simply insert " read=1"
behind the "information" position in that string. When
this is done simply write the hole string back to the
file.
greetings
Marsian

Similar Messages

  • How to insert text in existing file.?????

    how to insert text in existing file.?????
    my file contains simple text with numbers of lines having more then 10 MB size and it might be increase up to 100MB.
    i required to seek to spec. position and insert chunk of characters to file without overwriting existing one.
    I tried out with RandomAccessFile class Also.
    Pl. Suggest me way to insert String in existing file.
    Thanks ,
    Timir

    how to insert text in existing file.?????You can't "insert" text into an existing file. You can
    overwrite portions of an existing file or extend one by
    writing past the current end of file.
    If you want to insert text into a file you have to write
    out a new file.

  • Insert Text in PDF files?

    Prior to reformating my computer, I was able to insert text into pdf files.
    Now I am not seeing the instert text option, can you assist.
    Neil Borne
    Moderator's Note: Removing personal details.

    Thank you and it would appear that it should work, but I must click on the
    Comment Box far top right;
    When choosing Text, I receive the "Failed to load Application resource
    (internal Error).
    I have looked for updates, none available. I have also clicked on repair
    installation.
    What should I do next?
    Neil

  • Inserting text into a field at the current cursor position

    Does anyone know how to insert text into a field at the current cursor position? I would like it to work similar to the Syntax Palette in Forms. I cannot figure out how to retrieve the current cursor position in order to manipulate the text.
    Any help would be great.
    Thanks.

    Hi,
    If the button and the textfield are on in the same subform then this code should work in the click event of the button
    (This is JavaScript code so make sure the code is set to JavaScript and Client on the drop downs in the script window)
    (assuming the name of the textfield is TextField1)
    TextField1.rawValue = "some value";
    If they are in different subforms then you have 2 options
    Please note in both these options it is easier if the subforms have names ( I am assuming this to keep samples simple)
    option 1 -
    use the parent object to move up the tree till you are at the same level as that of the subform that contains the textfield
    e.g. 
    (Click Event of the button)
    this.parent.subformname.TextField1.rawValue = "some value";
    option 2 -
    Use the resolve node to make your way down from the top level of the form
    xfa.resolveNode ("form1.subformname.TextField1").rawValue = "some value";
    Hope this helps
    Malcolm
    p.s. I am making assumptions as the image/file you attached did not appear for me.

  • HT2488 How to I insert text into a this command in automator wine "Text goes here" this is a perl script

    I have spent hours trying to figure this out, automator is the hardest thing to figure out. All I want to do is emulate me doing this
    -Open terminal
    -type wine
    -drag and drop the location of an .exe file
    -hit enter
    Now this should be easy as all I have to do is do run shell script, insert argument and done, BUT IT DOESNT RECOGNIZE WINE!?!?! Pleas help me.
    Let me clarify.
    If I make an automator application that that runs the command "wine" and then inserts text into the space after that Then i will be set. But no matter what I do nothing works. If i set the shell to perl and pass input as argument....It doesnt work the $f and $@ stuff doesnt work.
    Wine is likely not recognized because is is pearl based so I set it to pearl, but how do i pass and argument over to it?

    Try
    /opt/local/bin/wine "$@"
    The "..." will protect the white space, but still allow $variable subsitutions.
    The $@ will substitute all the files you drag as a group to your Automator app.
    The notation "$@" does the substitution with each file properly quoted to protect the white space in the file path, but provide each file as its own quoted argument to the 'wine' command line.
    If you need to invoke 'wine' once for each file of a group of files you drag on to your automator app, then use
    for f in "$@"
    do
         /opt/local/bin/wine "$f"
    done
    This will loop through each file of a group of files you drag onto your automator app, and invoke 'wine' once for each file in the group.

  • Inserting Text into a web page

    I need to know how to insert text into a webpage, like google, search, and then get the result.
    Using the wonders of the internet I have been able to display a webpage, and see the HTML code that is generated, however, I don't know how to insert text into a web page, or get the result.
    Any help, or pointing into the right direction would be appreciated.

    What do you mean by insert into web page? Like
    prefill data on a form?
    Or like a search on google? What are you using to
    do this?
    I am guessing based on the info you gave in your
    question, that you might want to just look at the url
    of the page. For example search on google and you
    will see the text entered into the search field
    inside the url. Learn from that and develop a url
    that will search for the text you want to insert.
    If I am not understanding you, please clarify.Right now, I'm using the URL to search for me, which will work, but the search can be different from website to website, and I would like something closer to an automated form filler if I need to implement something like this again.
    Of course, something like an automated form filler would probably work better, if I were able to retreve the results

  • How to use OCR Font A type by the time of writing some text into Pdf fil

    Hi,
    I am generating one pdf file in java. How can I use OCR Font A for text of pdf file ..Please can any one help where can I get OCR Font A and how to use that one in java ... I want to write some text into pdf file and that text should use OCR Font A family ...
    Thanks.

    This document shows how to disable OCR during conversion; just do the opposite: https://forums.adobe.com/docs/DOC-3062

  • I have difficulty pasting text into the file name field(prefix only) while saving files.

    OS: WinXP sp3
    FF: 3.6.3
    I have difficulty pasting text into the file name field (prefix only) while saving files. example: File name is Pic123.jpg and I want to rename it ABC123.jpg and I have ABC loaded into the WinXPsp3 clipboard. When I highlight\right-click\delete "Pic" then attempt to paste the ABC, I get either no reaction, or upon multiple paste attempts, the ABC is appended to the end of the file, after the extension, as "Pic123.jpgABC". If I delete this unwanted suffix, or repeat the process several times, eventually I can delete the unwanted portion of the prefix and paste the desired text. Sometimes it works fine first try, but mostly it takes several tries. I'm using Firefox 3.6.3 but the problem existed in whatever previous version I had too. This issue only occurs when using the delete/paste; I can always manually change the name by typing. Thank you for your help.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    A possible cause is that the server sends a wrong response header.
    The server may not comply to RFC 5987 and sends a wrong Content-Disposition:attachment; filename header.
    * https://developer.mozilla.org/en/Firefox_8_for_developers#Network

  • Inserting text into table cells in Powerpoint

    Hi
    I have a named table ClientInfo on Slide 3 in Powerpoint. How can I programmatically insert text into the table's cells?
    Thanks
    Regards

    Hi Yahya,
    What did you mean named table? Did you mean the name of shape?
    If I understood correctly, we can use table object to manipulate a table shape on a slide. And here is a sample to insert text into the first cell for your reference:
    Application.ActivePresentation.Slides(3).Shapes("ClientInfo").Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = "Hello"
    Also here are some helpful links for learning PowerPoint developing:
    How do I... (PowerPoint 2013 developer reference)
    Object model reference (PowerPoint 2013 developer reference)
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cant insert Text into a TextBox. (Confusing Problem, CS6)

    Hello forum members!
    Just got the trial today and I am trying to insert text into a document. I press "T" and drag a box for a textbox. I then double-click inside that box to type something, and whatever I type absolutely NOTHING appears. It just blinks and nothing is actually typed inside the box.
    This is really frustrating. I have only just started and have one document that is fresh, so my question is what is the problem here?
    Thanks in advance,
    Shane Stocks

    Could you elaborate on that a little? I have taken a screenshot of my screen to show you how everything is. I have not touched any settings and have literally downloaded the trial about an hour ago.
    I do this. Click on the T, drag a box, then start typing. When I type, the icon does not move, and for some reason it seems what I am typing renames the layer tab. Please view the image, everything is there.
    Thanks again,
    P.S. The text-box does dissapear when the icon changes into a text icon, and the image above is me typing random things. Nothing appears.

  • Freeform to Text: How to insert Text into freeform

    How to edit text into freeform

    Hi FZRR,
    Could you share more information with us? Or you can upload the screenshot to OneDrive and share the picture link here.
    If you want to insert text into freeform shape, there are two methods:
    1. Insert a textbox on the freeform shape, edit text in the textbox.
    2. Select the freeform shape, and right-click > Add text.
    If there is anything I can do for you regarding this issue, feel free to post back.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to insert characters into a file using Labview

    I have collected acoustic data that I am turning into wav files. After the collection, I now know the file size and need to insert the wav file header on top of this file. Can anyone tell me how to concatenate two files, or insert the wav header (string) data into the other file? My current method is very inefficient. The collected data file can become extremely large, so I am trying to avoid reading this file. I would rather poke data into it without overwriting any existing data. Thanks in advance.

    hello
    See attached vi. It is a modification of NI warite wav vi. It only writes header. So Write a default header, append your data and write heder again using the number of bytes of audio.
    Hope this helps.
    "Qod natura non dat, Salmantica non praestat"
    Attachments:
    Cabecera_Wav.vi ‏77 KB

  • Inserting text into a Pages document with Applescript

    I want to create a Pages document from a custom template but be able to insert text at various points in the document (inputted data under headings etc). I would like to use Applescript but cannot get insertion points to work, is this possible? As usual, all help gratefully accepted.

    I have made a Pages template that contains tables and I want to enter text into sections of these tables
    That's a completely different story! But that's still possible using GUI Scripting. Here's an example:
    tell application "Pages"
        activate
        select table 1 of body text of front document
        tell application "System Events" to tell process "Pages"
            set theWindow to window 1 whose role description is "standard window"
            click button "Table" of tool bar 1 of theWindow
            keystroke "Cell A1"
            keystroke tab
            keystroke "Cell B1"
            key code 125 -- down arrow
            keystroke "Cell B2"
            -- and so on
        end tell
        select insertion point after table 1 of body text of front document
    end tell

  • Inserting text into JTextPane

    I have a requirement where I need to insert some text into a JTextPane within its DocumentListener. I read somewhere that this is not a good practice. What would be the right way of doing this?
    Basically, I'm listening to what user is typing and helping him by inserting some text automatically based on user choice.
    Please provide code samples.

    Hmmm - not knowing anything about the document listener - maybe they were talking about some kind of loop, where you insert text and then it triggers the listener to insert text which triggers the listener to insert text.... etc.
    Maybe there are some other user input listeners, such as the keyListeners which might be better?
    I haven't even had a look at the JTextPane API at the moment, so I don't know what I'm talking about.
    Cheers,
    Rene

  • Can't insert text into web page plus script error message

    I'm using CS3 and, on a fairly regular basis, when I am either pasting or inserting content (usually a newsletter of 500-1000 words), I get a message saying something like I can't insert text in this area. I definitely can insert text in the area as I have done it tons of times before. I sometimes have to cut and past a doc line by line to get it to insert. Very frustrating!
    Also, just recently, I've been getting a script error message, "An error has occurred in the script of this page" followed by Line: 992, Char: 106, Error: Unterminated String Constant, followed by the question: Do you want to continue running scripts on this page? I click Yes and everything seems to work fine.
    Help on either would be appreciated.
    Thanks in advance.

    You might want to make sure you are trying to copy plain text. It's possible that if you are copying from a Word document or another Web site that you are bringing along extra unseen code it doesn't like.  Try copying into Notepad first and then copying from Notepad into Contribute.  Not sure if that's the problem or not, but that's what came to my head first.
    I used to get an error that sounds similar (however it's not reproducing the error for me right now) to your error.  It was because some of my users had javascript menus on their page that Contribute didn't like.  However, if worked fine when you clicked yes and it was fine once it was published.   So if you are running a script that's probably why and I wouldn't worry too much about it as long as you can continue working and the page displays to your users correctly once published.  It's just annoying.
    Hope that helps.  Good luck.

Maybe you are looking for