Loading large documents

I need a way to load large documents without major performance issues.
At present, the best I can find in Swing itself is the PlainDocument class, which has issues once it crosses the size of about 1MB. As it gets closer and closer to 10MB, it gets slower and slower, and even higher just gets unacceptable.
I started off writing a custom implementation of Document, but the need to implement the listener methods bogged me down and I can't progress any further without further help.
I find it hard to believe that nobody would have written a Swing editor that can handle over 10MB of text, but I can't find anything with Google, so...
Has someone out there already tackled this problem?

I think you should create a document which reads the text from the
file whenever the data is requested by getText-method in the document.
You could also use some caching of the previous read text in order to reach a good performance.
For instance you could reserve a buffer (byte-array) of about 500 kb,
which I would split up in 500 arrays of 1000 chars, since 1000 chars should be enough to fill at
least a screen and somewhat above.
I would propose to keep a map for holding these arrays, and coupling them to the
offset in the file from which they are read.
By alligning the offsets from which you read in the file with the size of such an array,
you will never read overlapping parts in your buffer.
You will also need some mechanism for remembering which array is least frequently used or least
recently used and may be replaced by the newly read data once the buffer is full.
You will also need some mechanism for adding or changing data from the file,
since you cannot change the data on the fly in the file. You should use some caching of this
data (perhaps in some other file) and mix this cached data with the cached buffer when the
getText-method is called.
While saving the new file this data should be mixed with the original file and written to a new file which
will then replace the old file. Afterwards all buffers should be cleaned (especially the change-buffers).
You could adapt some auto-saving mechanism for doing this save after a specified time,
or when the change-buffers are growing to large.
Finally you could also opt to split the read-buffer in a buffer using strong-references to the arrays and
an additional buffer which uses soft- or weak-references to the arrays.
The strong-references will make the first buffer a solid reliable buffer of fixed size (minimum),
while the soft- or weak-references will make the second buffer a more soft buffer which can lose
data when the memory-requirements of the application are high.
This way you get a maximum size buffer when memory-requirements for the application do not claim the
soft-references of the buffer and you will always keep a minimum buffer for the application.
Data will always flow from the solid to the soft buffer and never backwards.
kind regards,
to add to the

Similar Messages

  • Bulk Loader Program to load large xml document

    I am looking for a bulk loader database program that will load a very large xml document. The simple bulk loader application available on the oracle site will not load this document due to its size which is approximately 20MG. Please advise asap. Thank you.

    From the above document:
    Storing XML Data Across Tables
    Question
    Can XML- SQL Utility store XML data across tables?
    Answer
    Currently XML-SQL Utility (XSU) can only store to a single table. It maps a canonical representation of an XML document into any table/view. But of course there is a way to store XML with the XSU across table. One can do this using XSLT to transform any document into multiple documents and insert them separately. Another way is to define views over multiple tables (object views if needed) and then do the inserts ... into the view. If the view is inherently non-updatable (because of complex joins, ...), then one can use INSTEAD-OF triggers over the views to do the inserts.
    -- I've tried this, works fine.

  • Loading large XML documents

    Hi everyone again :) Just sitting here trying to load a large XML document (it's ~13Mb). I know that's a massive XML document, but that's the way it is. The problem that I am having is that when I try to load the document I get an out of memory exception.
    Frankly, I'm not surprised, but is there a remedy? Any thoughts/ideas/solutions would be greatly appreciated. :)
    Ben

    Sounds like you are using DOM. The DOM parser you are using must be loading the whole Document tree right away. DOM really eats up memory. There are two possible solutions:
    1. Look into using a SAX parser. I don't know what you are doing with the xml, so I can't say whether or not that will work for you.
    2. Configure the DOM parser to defer loading nodes until they are requested, or if that option is not available with your parser, get a parser that will defer node loading.
    If option 2 sounds like what you need, then I suggest looking into the Apache Xerces parser. I am pretty sure it defers loading. You shouldn't have to change your code to work with the Xerces parser, you just have to make sure you set the proper system properties so that Java will automatically use the Xerces parser.

  • Problem loading large DNG images with Camera RAW!

    Hello,
    When loading large DNGs with Camera RAW 4.4 (for example, DNG dimensions are 9984x6656) CS3 says "cannot open the image because this is not a right kind of a document". EXACTLY THE SAME file is loaded without a problem using Camera RAW 3.7 and 4.0 (did not test other versions). Have you specially prevented loading of large files? Wouldn't it be better to provide this as an option? It's a real disappointment - new version of plugin CANNOT do the thing that older versions CAN. (Simply using older version is not an option, as I need to load RAWs from new cameras, like Canon 450D).
    Dear Adobe, please correct this problem :)

    It might be wise to give some insight like how the DNG was created, by what version of what software, if ACR is hosted in Photoshop or Bridge... What platform you are using, how much RAM, memory allocation, etc.

  • XSLT on very large documents w/XSU

    Hi:
    I need to load some very large documents, and I am looking at the example in Ch. 14 (14-4?) of the Muench book. It looks fine, but my question is that if, for instance, the element names don't match the table column names, and I need to use XSLT to change them, can I "stream" this? I am afraid that since XSLT wants to work on a "tree", it will want me to tranform the 6 gig (e.g.) file before passing it to the SAX parser. Is this correct? Can I make "mini" trees inside the multitableInsertHandler and work off of those one at a time? Can I do something like "XMLSave.applyStylesheet" (whatever it is) on a doc. from XMLDocumentSplitter? Complex question(s) I know. I think I am close, but missing the obvious.
    Thanks.
    Mike
    null

    Thanks for the clarification. I am planning on having one "rowset" element,and many "row" elements, each of which would have a "table" and "operation" attribute, because I am trying to mirror another database via its log file. Each row will be an insert/update/delete for one of several tables. Do you see a problem with this approach (i.e., doing away with most of the "rowset" elements)? I don't plan on batching at this point.
    On batching: If I did batch, and if the transaction fails, and I get a vector back where everything is set to (-1) or whatever it does, how do I know which records in the transaction actually succeeded?
    Thanks again,
    Mike
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Yes. The Multitable insert handler transforms one "subdocument" at a time using XSLT into a multitable-insert document. The result isn't processed directly by XSU, but is processed by some code in the example that iterates the resulting <ROWSET table="xxx"> tags and "choreographs" the use of an OracleXMLSave for each target table.
    Steve Muench
    Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
    Author, Building Oracle XML Applications
    <HR></BLOCKQUOTE>
    null

  • Loading Large XML into Oracle Database

    Hi,
    I am fairly new to XML DB. I have been successful in registering a schema to a table in the Database. Now, I have to load the appropriate XML into that table. I am using the Simple Bulk Loader program found on this oracle site, however, when I load my XML file I get the following error: ORA-21700: object does not exist or is marked for delete.
    So, I figured maybe simple bulk loader cannot handle large files? So I reduced my XML file and loaded it with the program and it worked. However, does anyone know how I can load large files into my registered schema table.
    Thanks,
    Prerna :o)

    Did you specify genTables true or false when registering the XML Schema ?
    Does you XML schema contain a recursive definition
    Is it possible that after reducing the size of the document you no longer have nodes that contain recursive structures...

  • Inserting a large document

    Hi I am trying to insert a large document a litte over 7M, but I get
    com.sleepycat.dbxml.XmlException: Error: Buffer: failed to allocate memory, err
    code = NO_MEMORY_ERROR
         at com.sleepycat.dbxml.dbxml_javaJNI.XmlContainer_putDocumentInternal__SWIG_0(
    Native Method)
         at com.sleepycat.dbxml.XmlContainer.putDocumentInternal(XmlContainer.java:884)
         at com.sleepycat.dbxml.XmlContainer.putDocument(XmlContainer.java:103)
         at com.sleepycat.dbxml.XmlContainer.putDocument(XmlContainer.java:54)
    I am usiing Java
    4 caches of 33554432 each
    jvm runs with -Xms256m -Xmx512m
    I already tried using XmlInputStream created with XmlManager.createLocalFileInputStream(java.lang.String) as well as XmlEventWriter, but both fail because of memory.
    I just found out that the shell loads it so fast I could not blink twice, so I guess I must be doing something wrong in Java code.
    Edited by: MauricioSC on Jul 6, 2009 6:10 PM
    Edited by: MauricioSC on Jul 6, 2009 9:35 PM
    OK something came to my mind while driving home and I tested it with almost 100% assurance that it was THE issue. Yes it was. My wrapper class around dbxml java stuff was creating a default index (a fully featured one) to any container by default. That's it, the 7M doc was crashing because of indexing operations set as default by the container while loading.
    Sorry to bother.

    2009-07-06 18:42:45.640 dbxml DEBUG: c.getContainerType()=1
    so, no. It has to be something else.
    Edited by: MauricioSC on Jul 6, 2009 9:47 PM
    OK something came to my mind while driving home and I tested it with almost 100% assurance that it was THE issue. Yes it was. My wrapper class around dbxml java stuff was creating a default index (a fully featured one) to any container by default. That's it, the 7M doc was crashing because of indexing operations set as default by the container while loading.

  • The document information panel was unable to load. the document will continue to open. For more information, contact your system adminsitrator.

    Hi Guys,
    I am creating the library using object model with custom content type.  When i am opening document from custom content type, the meta data fields are not displaying in the document and throwing below error.
    The document information panel was unable to load. the document will continue to open. For more information, contact your system adminsitrator.
    Document Information Panel cannot open a new form.
    The form contains schema validation errors.
    Content for element '{http://schemas.microsoft.com/office/2006/metadata/propertiesRoot}properties' is incomplete according to the DTD/Schema.
    Expecting: {http://schemas.microsoft.com/office/2006/metadata/properties}properties.
    But after saving the document, then meta data is enabled.
    Thanks in advance for suggested solutions.
    thanks
    Santhosh G

    Hi,
    For a better troubleshooting, I suggest to do as follows:
    1. Please try to update the Location column's schema by following the steps below.
     1) Go to Site Settings -> "Site Columns"
     2) Click on "Location", after the page is opened. Don't modify any settings, click "OK"  to forcibly update the field's schema.
    2. Re-edit the document information panel template to see if the issue still occurs.
    Please go to the Library setting > click the corresponding content type(need to enable managed of content types in Advanced settings) > click Document Information Panel settings.
    3. Here are some similar links about your issue, please take some time to look at them:
    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomizationlegacy/thread/243b4852-3f17-4a3a-b6d7-187d65a5f088/
    http://blogs.msdn.com/b/raresm/archive/2010/03/30/document-information-panel-cannot-open-the-form.aspx
    https://joranmarkx.wordpress.com/2012/02/10/sharepoint-document-information-panel-cannot-create-a-new-blank-form/
    If the issue still occurs, please check if the command below can help(change the site URL and the library name in the code):
    Apply-Fix -siteUrl "http://your site URL "
    function Apply-Fix($siteUrl)
    clear
    Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue # -EA 0
    [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
    foreach ($spwTarget in (Get-SPSite $siteUrl).RootWeb.Webs) {
    Write-Host "Checking Web: " $spwTarget.Url
    $list = $spwTarget.Lists["your library name"]
    $fields = $list.fields
    foreach($field in $fields)
    if($field.SourceId -eq '{$ListId:your library name;}')
    $schemaxml = $field.SchemaXML
    $schemaxmldata = [xml]$schemaxml
    $schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
    $schemaxml = $schemaxmldata.get_InnerXml()
    $field.SchemaXML = $schemaxml
    $field.Update()
    Write-Host "Fixed" $field.Title "field in the library"
    Write-Host "Done."
    More information:
    SharePoint 2010: Creating a Custom Content Type using Visual Studio
    http://www.codeproject.com/Articles/410880/SharePoint-Creating-a-Custom-Content-Type-usi
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Dennis Guo
    TechNet Community Support

  • Unable to load pdf documents on internet after downloading adobe reader XI

    Hi,
    I have just downloaded adobe reader XI. However when I try to load pdf documents off the internet there is an error message that says there is a problem with adobe reader with error 507:507. I am running on windows 7. Does anyone know how to fix this problem?
    thanks & regards,
    Selin

    my os is 32-bit windows 7 version 6.1 , i am using internet explorer 9. It works fine when i download it to my disk and open it from there.
    The problem suddenly happened for Adobe Reader X previously which I then uninstalled and installed Adobe Reader XI, but it didnt seem to solve the problem.

  • How to load a document in Muse without linking it to anything?

    I would like to load some documents to Muse before linking them to anything.  Is there a way to do that?
    So far I have been writing text and linking a new file / document from my computer to that text.....  but I don't really need that text as I just need the document to modified an HTML and include it in table later on...
    Here is an example of what I want to do ... Single Vane Pumps
    I would like to find a simpler way to link the document to my table, without having to link it to a random text just to have it available from Muse assets. <a class="nonblock" href="/assets/vtxb.pdf">VTXB</a></td>

    go to Files --> Add Files to Upload

  • Have Windows XP and Adobe 9 Reader and need to send a series of large documents to clients as a matter of urgency     When I convert 10 pages a MS-Word file to Pdf this results in file of 6.7 MB which can't be emailed.     Do I combine them and then copy

    I have Windows XP and Adobe 9 Reader and need to send a series of large documents to clients as a matter of urgency When I convert 10 pages a MS-Word file to Pdf this results in file of 6.7 MB which can't be emailed.  Do I combine them and then copy to JPEG 2000 or do I have to save each page separately which is very time consuming Please advise me how to reduce the size and send 10 pages plus quickly by Adobe without the huge hassles I am enduring

    What kind of software do you use for the conversion to pdf? Adobe Reader can't create pdf files.

  • How do I increase the font size of a large document?

    Whenever I try to increase the font size of a large document, the text boxes cross their boundaries and mix with each other, or partly disappear at the end of every page. Do I really have to adjunst every text bos in the document or is there a faster way? Im having this issue with adobe acrobat 11 pro

    This is not a feasible thing to do. Editing a PDF is a desperate last resort for so many reasons.
    Whatever you need to solve, you are unlikely  to solve it in Acrobat. Probably best to export text and remake it.

  • How can I change a page position in a large document?,

    How can I change a page position in a large document?

    Question asked and answered many times !
    Insert a section break just before the page to move.
    Insert a section break just after the page to move.
    Select the page's thumbnail
    cut
    Insert a section break where you want to insert the page.
    paste
    The required infos are available in Pages User Guide which isn't delivered to help helpers to help you.
    Yvan KOENIG (VALLAURIS, France) mercredi 5 octobre 2011 14:33:24
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How To Load A Document From An Array ?

    Hi All
    If i have an xml file
    <WhitetimeDocuments>
         <documents>
              <id>WhitetimeIntro</id>
              <name>Introduction To White Time</name>
              <location>WT_Intro.txt</location>
         </documents>
         <documents>
              <id>WhitetimeHealing</id>
              <name>White Time As A Healing Modality</name>
              <location>WT_Healing.txt</location>
         </documents>
         <documents>
              <id>WhitetimeClassOutline</id>
              <name>Outline For White Time Classes</name>
              <location>WT_Class_Intro.txt</location>
         </documents>
         <documents>
              <id>WhitetimeFacts</id>
              <name>Facts About White Time</name>
              <location>WT_Facts.txt</location>
         </documents>
    </WhitetimeDocuments>
    How can i load the document into a textarea component based on a button click by the user ?
    I have the httpservice call and a seperate Button Component for each document choice, but how do i then load the document ?
    Also how can a generate a dynamic list of buttons, based on the labelField 'Name' instead of having a static list of Button components ?
    Many Many Thanks
    Whitetimer
    Many Thanks

    Document should be on the server at some www.baseaddress.com/WT_Intro.txt.
    Assuming your XML is also on the server...
    Make the call to load the XML, parse the XML and get the url for the text file.
    Also Here you can read the names and pus them into an array list
    arraycollection: {"Name":value};
    For each url retrieved from the xml make a new call to the server and loat the
    txt. On the response you should have the text. (It is better to make the calls
    chained one after each other, since the response come back asynchronously, e.g
    on the response of one call make another call...)
    The names retrieved already can be passed as a dataProvider to a button bar
    component.
    HTH,
    C

  • HELP, PLEASE.. I'm looking for a App that I can install on both my iPad and iPhone, then when I load a document, picture, or anything on that app on iPhone or iPad, it will Sync with the other Device so both devices will end up with the same file .

    HELP, PLEASE.. I'm looking for a App that I can install on both my iPad and iPhone, then when I load a document, picture, or anything on that app on iPhone or iPad, it will Sync with the other Device so both devices will end up with the same file ...

    iCloud Drive: https://www.apple.com/icloud/icloud-drive/
    Dropbox: https://itunes.apple.com/us/app/dropbox/id327630330?mt=8
    OneDrive: https://itunes.apple.com/us/app/onedrive-for-ios/id477537958?mt=8

Maybe you are looking for

  • REFRESH BUTTON OF ALV GRID

    Hi Experts,       In ALV report i have to apply custom functionality when user clicks on 'REFRESH' button.Please suggest me how to catch this event.I have used the event 'AFTER_REFRESH' OF CLASS CL_GUI_ALV_GRID.But it is not the right event.Please su

  • Ipod cannot be updated the disk could not be readfrom or written to

    what does this mean? I don't have any disk,I'm just trying to download songs from my library to ipod and I get this message,please help

  • My new Zte Open c IMEI is disappeared after update.

    Hello, I try to make a manual update on my Zte Open C following the instructions you provide here ( https://developer.mozilla.org/en-US/Firefox_OS/Developer_phone_guide/ZTE_OPEN_C ). Everything appear to be ok until the phone was rebooted(at 98% of t

  • MCTI report

    Hi, I need to copy the standard report tx MCTI because i'm using other partner, how can i copy this?? thanks ale.

  • Personalized ringtones

    I have figured out how to use my own music as ringtones, but does anyone know if I can personalize ringtones per person-- so if one person calls it's one song and it's another song if someone else calls?