Manipulating a file's contents however I choose...

without using a standard approach such as:
Flie1, Flie2
* Open a stream to read file1, searching for the item of interest to manipulate.
* Manipulate the item of interest locally.
* Open a stream to file2 and write the contents of file1 in order including the now manipulated item of interest.
* Delete file1
This approach may work well for small files but I am thinking of an approach that will be usable for files of any size. It would be unreasonable to use this methodology to manipulate a 100 MB text file. Thus I am interested in modifying the contents of a file and leaving all remaining contents I do not want to modify untouched.
I just can not think of a way to do this.

Always Learning wrote:
jverd wrote:
Always Learning wrote:
I thought there was some mechanism in Java allowing the editing of a file without the need of involving additional files.There are other schemes. Some of them have been mentioned here. Which one is appropriate, and whether they are "better" than this scheme, depends on your requirements, >your constraints, your context, and your definition of "better."Do you have any suggestions. Not until I know what the problem with the current approach is.
Perhaps "better" is relative to my thinkingYes. I've stated as much a couple of times already.
Thus I ask, do you have any scheme you would like to share here within this thread?I can think of at least two off the top of my head. One of them was already mentioned explicitly in this thread: RandomAccessFile. Another approach would be to read the whole file into memory, manipulate the contents in-mem, and then write everything back out to the original file.
As I already stated: Which of those (or other possible candidates) is better, and whether any of them are even "better" than the original approach, depends on your specific requirements and context.
Perhaps I was analyzing the required amount of syntax and thought there may be a better scheme from a syntactical point of view.Wait. Your problem with the 2-file approach is how much code you have to write? Oy ve.

Similar Messages

  • Windows File CS Content Crawler - How to change crawl method?

    Hi,
    I have encountered an odd issue. I am using a Windows File CS Content Crawler to pull in some PDF files from a remote folder.
    However I noticed the Windows File CS Content Crawler is crawling in the document title rather than the actual PDF filename.
    I have checked the admin screens and I cannot find any way to tell my Windows File CS Content Crawler portlet to grab filenames and use these as the file display name when crawled in.
    The business clients do not use the document title and meta features and will not use them in the future so the way the current Windows File CS Content Crawler portlet crawls documents into the portal will not work as most will not have a document title or will have some default internal name.
    For example the PDF documents I am crawling in have Document Title's that have no relevance to the document filename.
    We are only interested in the filename and not the document title (however we may use the field in the future for meta information). Apart from doing some development work to make a custom crawler is there any other way to change the behaviour of the Windows File CS Content Crawler.
    I had to go into each document property in portal and modify the name field to the correct filename as it was using the value found in the Document Title field (incorrect).
    This seems wrong to me, I can understand using the meta data information contained in files to do the crawling and make searching better however how do you do this with a PDF file that you cannot search against inside portal anyway?!

    You can acomplish by changing the Global Document Property Map.
    I don't have the specific screen in front of me so this is from memory.
    Change the Name property to File name
    Change the Title property to File name
    You might have to experiment a bit with some test documents.

  • File sender content conversion

    hello
    I have a txt file sender content conversion in SAP PI.
    I define in the content conversion 6 fields names(field1, field2, field3,field4,field5,field 6) but the fie that I am loading has only three field(field1,field2,field3). the file is still loading though there is a different in the structure between what I define in the PI to what is loading to the PI.
    is there a way to send an error with out loading the file?
    I read about the count function in the mapping. isnt there a build in function that suppose to load only the structure that is define?
    Thanks
    Kfir

    If you define 6 fields and only 3 are present in the test file then you wont get an error (AFAIK)
    However, if you define 3 fields and there are 6 present in the source file then you will get an error saying more number of parameters found.
    isnt there a build in function that suppose to load only the structure that is define?
    I dont think so....this may however be achieved using a custom adapter module.
    Update:
    Just remembered that SAP PI (7.1 and above) comes with inbuilt XML-validation function....check if that helps in your design.
    Regards,
    Abhishek.
    Edited by: abhishek salvi on Dec 15, 2010 1:12 PM

  • Can I delete the PDF file's content in Adobe Reader plug-in?

    I create a plug-in for Adobe Reader, when I open the PDF file, can I delete the PDF file's content in the plug-in?

    The people here are visitors who might have knowledge and might choose to share it, if they have the time, and feel like answering a question. Your questions, instead, suggest that you think it is someone's job here to answer your questions. If you want it to be someone's job, you should raise a support case. This too will require patience.
    You will not welcome this advice, I am sure, but it is well not to try to use your own deadline to try to make other people feel the problem is more urgent to them.

  • IStore Uploading source files to content repository

    I follow iStore Quick reference guide and try to add file to content repository. I use a user with iStore Administrator responsibility however from the content page I see the links/tabs to Usage Summary/Media Objects/My content/Library/Pending Approvals/Trash but not Content repository where it is supposed to be possible to add files/images etc to oracle content repository. Any hulp would be appreciated.

    The "report abuse" link for the original post in a thread is in the Actions box to the right of the post.
    I seem to spend more time reporting posts to be moved than answering questions.

  • Stranger error:Old file not found.However,a file of the same name was found

    Hi All,
    I appologise if its not the right forum...
    I am a bit baffeled here by the following error when I am trying to install Java SDK or just JRE.
    I upgraded my windows 2000 box to win XP home edition, installed the latest updates etc and then tried to install java....
    and got the following error
    bin\appletviewer.exe:
    Old file not found.However, a file of the same name was found.No updates done since file contents does not match.
    I have removed everything from system that I could imagine might be using Java directly or indirectly. No JRE on the system, no old java folder under C: drive etc, But I still get the same error. I have never come accross a stupid error like this before. Any help will be appreciated. Thanks
    Message was edited by:
    Khalid.Ali

    hunmm..thanks for the reply, I will try to find appletviewer.exe, however, my guess is that file should be there cus I am just trying to install it from standard java SDK installation.
    Yes I did not do checkdisk and I will do that and post my findings

  • Recover a single file in Content Services

    I've been asked to document how we would go about recovering a single file in Content Services. The Trash/Archive angle I'm clear on, but what about an extreme case. Lets say that someone created a file, trashed it, emptied the trash, and then it expired from the Archive before the user realized that they needed the file.
    Is it possible, and if so how would one go about getting the file back assuming that there is a full db backup once a day?
    Would enabling BFILE aging help? If so, how?
    On a related note: If archive is set to expire content after 1 month, but BFILE aging is turned off, when does deleted content get purged from the Archive? It's not 1 month, as I have deleted files in the Archive going back to January.

    Archive expiration and BFile aging are orthogonal. BFile pushes the LOBs of documents that are in the archive to bfile. Archive expiration deletes files from the archive after the configured time. If this is not the behaviour you are seeing please file a TAR and they can help check whether your system is configured correctly or if you are running into a bug.
    regards,
    -sancho

  • File Sender Content Conversion: Help needed

    Hello Experts,
    i need help with file sender content conversion:
    i have a file which looks like this:
    12329460  24.01.09/07:01  167     Y010122851  136086  43300007            E70115  1L2_96_1
    12329660  25.01.09/07:02  157     Y010122851  136086  43390007            E711J5  1L2_96_1
    as you can see 8 fields, separated with whitespaces
    and i want and xml file which looks like this:
    <DT_DATA_FILESENDER>
      <Recordset>
          <Data> 
            <field1>12329460</field1>
            <field2>24.01.09/07:01</field2>
            <field3>167</field3>    
            <field4>Y010122851</field4> 
            <field5>136086</field5> 
            <field6>43300007</field6>
            <field7>E70115</field7> 
            <field8>1L2_96_1</field8
         </Data>
          <Data> 
            <field1>12329660</field1>
            <field2>25.01.09/07:02</field2>
            <field3>157</field3>    
            <field4>Y010122851</field4> 
            <field5>136086</field5> 
            <field6>43390007</field6>
            <field7>E711J5</field7> 
            <field8>1L2_96_1</field8
         </Data>
      </Recordset>
    Would you please let me know how the datatype has to look like?
    And especially how the FCC has to be configured for this scenario?
    Thanks in advance,
    Chris

    > With fixed lengths i get it working,
    >
    > but with de fieldseparator 0X09 it does not work,
    > would you please tell me the complete FCC config not only the fieldSeparation line?
    Well Christian,
    There is one thing, eithere you can use fieldSeparator or fieldFixedLengths you can not use both together. So in your case do not use fieldSeparator.
    The complete FCC is almost same as given in the blog in my previous reply. See the final output in that blog and create your data type accordingly. e.g.
    Recordset
    ------Item 0...unbound
    --------Field1 0..1
    --------Field2 0..1
    --------Field3 0..1
    --------Field8 0..1
    Regards,
    Sarvesh

  • I recently lost my windows laptop due to a virus. I had backed up all files onto a drive(files only). However no itunes playlists. i have all my playlists on my iphone and pics etc however when im trying to sync to my new computer itunes deletes all data

    I recently lost my windows laptop due to a virus. I had backed up all files onto a drive(files only). However no itunes playlists. i have all my playlists on my iphone and pics etc however when im trying to sync to my new computer itunes wants to  deletes all data off of my iphone so i click cancel
    i want to update to iOS 5 and still have itunes be able to copy my playlists from my iphone. for free. why does apple provide a recovery from iphone option?

    If you have a backup, restore the ENTIRE iTunes folder to the computer.  This restores the library and device association files.  If for some reason you chose to only back up the media and not the entire iTunes folder, then the only option is to let iTunes wipe the drive and re-sync.

  • Copy any kind of file from content server to network directory

    Helli All
    The question:
    I nee to copy any kind of file from content server to any network directory.
    Explanation
    1. transaction CV02N
    2. There is attached file for a document in tab "Document data/Original"
    3. This file stored in content server
    4. I wrote program code that creates path of the stored file that finally looks like
    http://cont:8888/ContentServer.dll?get&Version=.....*...&compid=app1.doc
    where app1.doc is file's name and I have to copy this file into network directory.
    The problem is that this URL open the file instead of just pointing to him
    so that no function or method can't see this file and as the result I got message that
    the file doesn\t exist.
    Please, advice.
    Regards,
    Daniel.

    many many thanks for ur help. i really did not check the URLClassLoader properly.
    but i would like to hear a little more from u. i have another question. here in this code (provided earlier), i searched for attribute values in the manifest file, then again i load the required class file from the very url. is it not good to retrieve the whole jar file first, and then check attribute values inside manifest file and load the required class files from that jar file that is already downloaded without going to that url again? how can i do this?

  • Windows File CS Content Crawler - Permission Issues

    Hi,
    Having a strange problem with a Windows File CS Content Crawler.
    We have setup a shared directory on a server (on the same subnet/network as the portal server) where users drop their files (Word, PDF, Excel etc).
    We have a Content Crawler job that crawls the files into Knowledge Directory, we then display the documents in a portal on one of our communities.
    When an administrator level user clicks on the document link in the portal, the document is opened correctly i.e. you get a prompt to open or save. When a normal non-admin user clicks on the document link they receive the following error:
    Error - Gateway was not able to access requested content. If the error persists, contact your portal administrator.
    When I reviewed PTSpy I found the following message:
    "user xxxxx does not have access to object id=232......."
    Anyone experienced the above and know how they resolved this?
    Thanks in advance,
    Tahir

    This is a permission problem, most likely on the data source that the crawler is using. Open the data source you used to create the crawler and see if its ID is 232. If it is, then you need to add whatever users/groups that should have access to the documents to the security ACL for the data source object. That will fix the problem.
    Does the error also say what class id the object is? That would let you determine exactly which object is causing the problem if it is not the data source.
    DJ Dewey | VHA Inc. | [email protected]

  • Have turned Home sharing on in "File", but if I try choose the sharing tab in "Edit", "Preferences", It says Bonjour needs to be activated.  Where do I do this?

    I'm trying to share my libraries on different PCs.  I have turned Home sharing on in "File", but if I try choose the sharing tab in "Edit", "Preferences", It says Bonjour needs to be activated.  Where do I do this?

    Try updating iTunes on your PC. Hopefully it'll re-install or fix the Bonjour issue.

  • Hi there, i bought an Ipad air and trying to upload the pictures that i have taken in raw files via itunnes. however pictures are quite blurry which is disappointing. appreciate any suggestions on how to make it right via itunes?

    Hi there, i bought an Ipad air and trying to upload the pictures that i have taken in raw files via itunnes. however pictures are quite blurry which is disappointing. Appreciate any suggestions on how to make it right via itunes?
    Thanks

    Hi there, i bought an Ipad air and trying to upload the pictures that i have taken in raw files via itunnes. however pictures are quite blurry which is disappointing. Appreciate any suggestions on how to make it right via itunes?
    Thanks

  • ...file Sender content conversion 'lastFieldsOptional'  error

    Hi All,
    I am working on a File Sender content conversion--> flat file to XI.
    it's fixed length field all the rows with same column.
    090627 344535AFDFG+GBP65433 ASDSSD GFD dFSSGFD 6757532
    090627 344535AFDFG-GBP65433 ASDSSD GFD dFSSGFD 6757532
    090627 344535AFDFG-GBP65433 ASDSSD GFD dFSSGFD 6757532
    090627 344535AFDFG-GBP65433 ASDSSD GFD dFSSGFD 6757532
    090628 344536AFDFG+GBP45434 ASDSSD GFD dFSSGFD 6757532
    090628 344536AFDFG-GBP45434 ASDSSD GFD dFSSGFD 6757532
    **EOF**
    I am sucessfully able to handle the file if i remove "**EOF*" from incoming file. But i get "lastfieldsOptional" error with "*EOF**"
    >
    Parameters-
         Recordset Structure - ROW,*
         Recordsets per message - *
        ROW.fieldFixedLengths - 6,8,20,10,30,1,3,1,11,1,11,6,10,10,20,10,10,2,6,6,2,6,6,3
        ROW.fieldNames - INV_DATE,INV_NO,PAYMENT_REF,CUST_NO,CUST_NAME...etc etc
       ignoreRecordsetName - true
    There are parameters available to ignore Last field(last column) of a Row/Rocerdset
    but how to ignore the last row of the file.
    Plz suggest some parameter to ignore the last row/field of the file.
    Regs,
    Ansh

    Ansh,
    .lastFieldsOptional  is obselete and you cannot use. Please see sap help:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    The best thing comes to my mind is use:
    .keepIncompleteFields as YES
    Also give a try with:
    .missingLastfields as add
    So with this I think your last line in the file will read into XI. But the value of last line is **EOF**. So the length is 9. Since your the first two fixed lengths are 6 and 8. You will have these values as ***EOF and ***. So while mapping you can use doesnot satrt with * and map it, so that your last line will be ignored.
    Note: with this apporach you have to make sure your first two columns never start with *. If you have a doubt then you can use the condition doesnot equal to ***EOF for first field and doesnot equal to *** for the second field when you map. I hope it makes sense to you.
    Regards,
    ---Satish

  • How to read a file which content hindi characters.....

    I m reading a text file which content hindi characters.... but m nt getting the right result. It shows garbage instead of hindi characters.
    plz somebody help me....:(

    You posted this in the XML forum. Is this an XML file you are asking about?
    And we need definitions for some of the terms you used in your original post. You said "it shows garbage". We need to know:
    1. What is the "it" there?
    2. How does it "show" something?
    3. What does the "garbage" look like.
    In future you will find you get better answers if you write better questions.

Maybe you are looking for