Fastest Way to Load Text Files Containing Thousands of Words

Hi, can anyone give me suggestions for fast loading of files containing many bytes in the form of a single word on a different line. The average file size is 45 kb. I'm currently splitting the words into separate files each containing 4000 words a piece. I use a different thread to read each file and then add all of the words into a single vector, formed by joining the vectors of each reader thread. Any suggestions for speeding up the process? (Currently, it takes about 30 seconds to load 52,000 words). My OS is Windows2000

Something seems wrong. There is no way that what you describe should take anywhere close to that amount of time, unless the computer is a constraint. I created a file of 56,000 lines, each line consisted of the byte string "abcdefgh" plus a \r\n,
for a total of 10 bytes per line - a total file size of 560,000 bytes (547 kb)
The following program read the file, created an ArrayList, and added the 56,000 lines to the list in less than 1 second, about what I expected. You might want to run it and see what you get.
import java.io.*;
import java.util.*;
class Zxin
    public static void main(String[] args)
        throws IOException
        FileInputStream fis = new FileInputStream(
            "C:/Documents and Settings/Chuck/My Documents/Java/junk/word.txt");
        InputStreamReader isr = new InputStreamReader(fis);
        BufferedReader br = new BufferedReader(isr);
        List<String> list = new ArrayList<String>();
        String data;
        while ((data = br.readLine()) != null)
            list.add(data);
        System.out.println("The list contains " + list.size() + " entries");
        System.out.println("The first entry in the list is: " + list.get(0));
        br.close();
}It printed these 2 lines:
The list contains 56000 entries
The first entry in the list is: abcdefgh

Similar Messages

  • What is the best way(fastest way) to loads sound files

    Hi,
    I am using adobe edge version 3 to create a website....I have added sounds to the website usings adobe edge itself.I use many sound(256 files,total size 6 mb)....When someone visits the website it takes a long time to load.How can i prevent this ???
    Thank you
    Nithin

    You can check some of the tips mentioned in this link - http://www.adobe.com/inspire/2014/02/edge-animate-audio.html for handling audio.
    Thanks and Regards,
    Sudeshna Sarkar

  • Flash wont load text file

    Hi Everyone,
    I have a flash program which reads some data in from a text
    file and stores them in a list box. The problem im having is that
    on one of my computers it works fine, however on the second
    computer, there is no log entry in the
    windows\system32\logfiles\w3svc1 file which indicates that the text
    file has been opened.
    So from this i assume that there is something wrong with
    flash and IIS. Is there someway to turn off the IIS in flash so it
    wont load a "
    http://localhost/test.txt"
    file?
    I think I may have accidentally switched off an option but i
    have no idea where this would have been. Any help would be great.
    Thanks

    hi all
    at last i found the way to load text file in to the textArea
    it's like
    <mx:Script>
    <![CDATA[
    private function loadText():void {
    var l:URLLoader = new URLLoader(new URLRequest('2.txt'))
    l.addEventListener(Event.COMPLETE, finishLoading);
    public function finishLoading(evt:Event):void {
    var myData:String =new String(evt.target.data)
    txtBox.text=myData;
    ]]>
    </mx:Script>
    this should works because it's work with me
    enjoy the code
    Sanji

  • SSIS none text qualifier results in text file containing "_x003C_none_x003E"

    There is a bug in SSIS when exporting data from SQL to a comma delimited text file where you specified no text qualifier.
    This bug apparently only occurs when you develop the SSIS on a x64 win7 PC and copy the .dtsx file (windows explorer copy/paste) to network path of a x86 SQL server and schedule the job to run from SQL Agent on the same x86 SQL server.
    When the SSIS runs, the text file is written out containing text qualifier = "“_x003C_none_x003E".
    If you look at "
    _x003C_none_x003E", it actually means <none>.  x003C = "<" and x003E = ">".
    If you go into the SSIS package, double-click in the connection manager section to open the flat file connection manager editor and try to clear the text qualifier removing the <none>,
    the <none> value get added back in.
    The only work-around is to NOT open the
    flat file connection manager editor, but instead make the change using the property window and clear out any value in the TextQualifier field.
    Other similar problems occur when you actually want to put a real value in the text qualifier.  For explain if you select the double-quote as the text qualifier and copy to a
    x86 server and run, you end up with a text file containing the value "
    _x0022" around each field instead of a double quote.
    In my mind this is a serious bug, I did some research and other people have been having this same issue.
    FYI, the SQL server is currently SQL2008 with SP2.  I will try to get it updated to SP3/4 this weekend to see that will help.
    FYI2, when I am developing the SSIS using VS2008 and my local test/run is done through visual studio on my Dev PC (x64).  Everything works fine this way.  I do not have a instance of SQL on my machine so I did not test it running from SQL Agent
    on my PC.

    Todd,
    Sorry to revive an older post, but we are currently running into this problem...again, but this is happening on SQL Server 2008 R2 SSIS servers and the corresponding developer machines.
    Everything that I'm finding in forums and blogs pretty much points that this is an issue with build mismatches (i.e. one system not being caught up to the server while others are), but I have yet to find anything that really outlines how to properly rectify
    the situation and prevent it from happening going forward.
    Currently all but our production server (from a server perspective) are exactly the same version numbers (same CU applied).
    I can't really speak to all of the developer boxes, but mine matches all but the production server (production is showing a lower number than the expected 10.50.2500.0).
    As shown below, what is really odd is the second entry and last entry.  Second entry is showing SP1 as the generic identifier, but yet shows Build 7600.
    The bottom one shows RTM in the generic identifier, but yet shows Build 7601 Service Pack 1, and the version number isn't the expected 10.50.2500.0.
    SQL Server Version
    Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)   Jun 17 2011 00:54:03     Standard Edition (64-bit)
    on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
    Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)   Jun 17 2011 00:54:03     Standard Edition (64-bit)
    on Windows NT 6.1 <X64> (Build 7600: ) (Hypervisor)
    Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)   Jun 17 2011 00:54:03     Standard Edition (64-bit)
    on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
    Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (X64)   Apr 22 2011 19:23:43     Standard Edition (64-bit)
    on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

  • Best way to handle text files in OD10g

    We have a requirement to store reports in text format into a database field, to be able to view the reports, and to print them if desired using Forms 10g. What is the best way to handle this?
    - define the field in the database as clob or blob?
    - if CLOB is the choice, what tools to use to upload CLOBs to the database (since webutil transfer is for blob only)?
    - in Forms 10g, can one use the Forms data type LONG for CLOB?
    - can you do Forms search on clob and blob fields?
    - how can reports that are stored in fields be viewed without first downloading to the client workstation?
    - in Forms 10g, what is the best way to view text files residing in local PCs: "host notepad myFile"?
    Thanks much for your reply!
    gk

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to view Text files from Mac on iPhone 4?

    What is the Best way to view Text files (loaded) from my Mac onto my iPhone 4?
    Will any of the "readers" (e.g. Kindle, Kobo) allow me to put my own text files onto my iPhone and read them easily?
    Thanks

    I actually purchased GoodReader because it is easy to transfer files without iTunes.  I dislike the file sharing through iTunes.   You can use a Mac or PC.  Once I was in the app I clicked the "Wi-Fi" symbol which brings me to "WiFi-transfer."  It will show this --
    "WiFi status: ON
    Use one of the following addresses exactly as you see them
    1. IP-address: http://192.168.0.98:8080 <-- Local LAN address the iPhone is broadcasting on.
    2. Bonjour-address http://Myname-iPhone.local:8080"
    All you have to do is type one of those addresses into your browser. (Safari, etc.)
    It will take you to a page that has iPhone Connection and a list of options.  You can either create a new directory within the application or use an existing one to upload a text file.  It's rather simple, you just select "Choose a file to upload" > Select your file > Press upload > Start the app and see your text/pdf/whatever file.
    You can also connect to a server to download a text file, browse the web, or enter a url.  I see it also has an ICloud folder which I'm not sure if it integrates with Apple's iCloud or not, I think it does.  I'm not affliated with the app and I'm not saying you have to buy it, I'm just a happy user.
    If you don't want to buy this app let me know I'll keep looking for a free or cheaper one for you if you want.

  • How to read text file contain chinese character ?

    Hi XI Expert,
    I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
    Please advise me how to maintaine the chinese character in PI 7.0 SP17.
    Thank You and Best Regards
    Fernand

    Hi,
    Refer these threads..
    Receiver file adapter corrupting characters
    Problem in converting special characters in input text file
    Here is one more useful guide..
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Regards,
    Sarvesh
    Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM

  • How to load text file data to Oracle Database table?

    By using Oracle Forms, how to load text file data to Oracle Database table?

    Metalink note 33247.1 explains how to use text_io as suggested by Robin to read the file into a Multi-Row block. However, that article was written for forms 4.5 and uses CREATE_RECORD in a loop. There was another article, 91513.1 describing the more elegant method of 'querying' the file into the block by transactional triggers. Unfortunately this more recent article has disappeared without trace and Oracle deny its existence. I know it existed as I have a printed copy in front of me, and very useful it is too.

  • How to load text files in GUI

    plz tell me .. how to load and compare two text files using file popup's . example file i have attached..
    Attachments:
    testW_FF.txt ‏2 KB

    I don't understand whether your question is on how to load text files or how to show them on a panel or how to compare them... or all aspects together!
    The first operation (loading the file) can be accomplished with functions included in the Formatting and I/O Library like OpenFile, ReadFile and so on; with a file like yours even FileToArray could be an option.
    How to show the data on screen is heavily dependent on what you intend to do with them: data can be shown in textboxes, listboxes, tables or graphs so... what do you want to do?
    The same applies with comparison: without additional details is difficult to give you the proper hint.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Best way to read text files at multiple production sites

    Need to write a solution to read txt files that contain binary data on multiple SQL Servers. I have no control over the SQL servers, they are not mine. Thinking of BULK INSERT or bcp. But must something on the server be turned on for it to work? What are
    some other production solutions for reading files and loading the data into a SQL table?

    Hello,
    I think the best way is create a SSIS package to import data into SQL Server tables. Here are some articles for your reference:
    http://codejotter.wordpress.com/2010/04/06/importing-multiple-text-files-using-ssis/
    http://technet.microsoft.com/en-us/sqlserver/dd941934.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • How to load text file

    Dear All,
    How is it possible load a text file that contain SQL commands in the form and then execute the commands.
    Regards

    Hello,
    You can have dynamic SQL within the Forms module via the EXEC_SQL package, but it is not really made to execute a whole file content.
    You could write a databased function (or procedure) that uses the EXECUTE IMMEDIATE instruction, then call this procedure from Forms.
    Anyway, I think that in all cases, you probably have to split your text file in several comprehensives single SQL orders, or at least send entire PL/SQL blocks.
    Francois

  • Loading text file with flash lite 3.0 problem

    Hello,
    I recently ran into a problem with loading a plain text file with Flash Lite 3.0.
    I know there is a way to load name/value pairs using LoadVars class or XML file using XML class. Both methods work great, but these classes parse the data loaded and I need to load just a plain text - no pairs or xml structure. (its because Im loading specific file format, so I can't make any changes to it)
    There is a simple way how to achieve this in Flash using Actionscript 2 by extending the LoadVars class and overriding the onData() method. I used it plenty of times and it works fine.
    There is an example of implementation:
    // the PlainData.as file
    class PlainData extends LoadVars {
        function onData(str) {
            trace(str)
            this.onLoad(true);
    // now in the main file
    var my_data:PlainData = new PlainData();
    my_data.load("my3dmodel.obj");
    This code traces unchanged content of my3dmodel.obj file.
    The problem comes when I try to run this code using Flash Lite 3.0. The code stops working just by changing player version in publish settings to Flash Lite 3.0. It doesnt display any error, but also doesnt trace any content.
    Is there a reason why you cant override onData method in LoadVars class in lite version of flash or am I doing something wrong?
    (also overriding onLoad() method works fine in Flash Lite)
    Ondrej

    Thanks Man
    But i m very unhappy !!! :-(
    1M data to transfer my mp3 files is very small !!! hehehe
    Thanks a lot
    See ya
    Carlos Eduardo Burko - Curitiba - Brazil - Macromedia
    Certified Professional
    "biskero" <[email protected]> escreveu na
    mensagem
    news:e98nrb$a6e$[email protected]..
    > Ciao Carlos,
    >
    > yes you can load mp3. The only issue is that the FL2
    will need to load the
    > entire mp3 in memory which mean you are limited to the
    avalable memory and
    > also
    > there is a limitation of 1M data transfer.
    > Try to create a sample application to test it. You need
    to use the
    > loadSound
    > API.
    >
    > Alessandro
    >

  • Is there any way to load idml file into InDesign server Programmatically

    Hi,
         I am very new to InDesign Server development. I was able to load tagged text and generate image using InDesingServer Java APIs. Now I have new scenario to generate image. My scenario is to load an idml file into InDesign Server, then I need to generate an Image using this idml file.
         Is there any way to do this using InDesignServer Java APIs.
         Thanks in advance.
    Thanks,
    Ravi Kishore.CH

    I am not aware of a direct way of loading data from excel into
    oracle. I usually export the data into Access and then through
    ODBC save the data into a new table in the DB.
    Hope this helps.
    SUnder
    Raju Gorakhia (guest) wrote:
    : I am working on forms4.5 & i am looking for the method with
    : which i can directly access the xlsspreadsheet and upload into
    : some table into oracle database.
    : If there is no such method that how i will upload that
    : spreadsheet into the database?
    : Is there any way with which i can convert the variable lenght
    : file into fix length format with some specific delimitor so
    that
    : after that i can call sqlloader & upload that file into the
    : table?
    : Thanks Regards
    : Raju
    null

  • Load text file with diff delimiters

    I need to load a text file that is pipe "|" delimited except for the last field that is not delimited by a pipe but with whitespace
    when executing the mapping the only place where I get a problem is on the last field
    "Field in data file exceeds maximum length"
    my initial thought was it not using TRAILING NULLCOLS but it is
    But looking at the code it generates the problem is obvious
    I write the code like this
    Options ( Errors = 50, Rows = 2000, BindSize = 90000)
    Load Data
    Infile 'file1.txt'
    Into Table "table_name" Truncate (
    field1               Char          Terminated by '|' ,
    field2               Integer External Terminated by '|' ,
    field3               Char          Terminated by '|' ,
    filed4               Decimal External Terminated by whitespace)
    warehouse builder writes it like this
    FIELDS
    TERMINATED BY '|'
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    ( "field1 " POSITION (1) CHAR ,
    "field2" INTEGER EXTERNAL ,
    "field3" CHAR ,
    "field4" Decimal External
    these are two correct way of loading data
    how do I tell warehouse builder to load data where there are more than one termination charater

    s.split(delims) will return an array of strings, not a string. So you need to declare list as an array list of such arrays:ArrayList<String[]> list = new ArrayList<String[]>();(It's a good idea to copy and post compiler messages here, so no-one has to guess. Likewise indicate which line of your code they are referring to.)
    [Edit]If it only the contents of the array you wish to put in the array, then you can just say List list = Arrays.asList(s.split(delims));

  • Load text file into applet

    hi,
    I am new to java and really need some help.
    I want to load / read a text file in my applet line by line
    the text file looks like:
    P,161,127,3,ff6599c2
    P,161,127,3,ff6599c2
    P,161,128,3,ff6599c2
    P,161,129,3,ff6599c2
    etc.
    the code I tied and did not work looks like:
    class read
         public void main( String[] args)
              int i;
              if (args.length < 1)
                   System.out.println("Please enter file: read<datei>");
                   System.exit(-1);
              try
                   BufferedReader in =new BufferedReader(new FileReader( args[0]));
                   String line = new String();
                   while((line=in.readLine())!=null)
                        System.out.println( line );
              catch(IOException e2)
    has anybody an idea how to do it?
    Thanks a lot
    Silke

    <PRE>
    First off you need to create a class which extends the
    Applet class. The applet class does not have the
    method "public static void main(String args[])". Instead it has a method "init()". In the "init" method you should
    write the code that you would write in "main". The "init"
    method is only executed once. When the applet is first downloaded. Here is a sample code, but there is one other factor to note. Applets have trouble accessing
    files on computers. This goes above and beyond the
    applet sandbox which locks up an applet. In my experiences I have only managed to read and write text
    files to the desktop through applets. The program can
    be used by entering the file name in the text field
    at the top of the applet and then clicking the "Read File"
    button at the bottom of the applet. This code segment is untested and it has been some time since I have done
    applet programming but it should work. You may have to
    edit the security policy file(security.policy) to grant permission to your codebase before this functions properly because it involves reading from the file system. The grant should look something like this(if you are running under unix/linux I believe you would substitute"file:\\\" with "file:/"):
    grant codeBase "file:\\\<Directory Path that contains
    the MyApplet class" {
    java.io.FilePermission "read", "*"
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    <Applet Code="MyApplet" width="300", height="300">
    </Applet>
    class MyApplet extends Applet
    implements ActionListener {
    TextArea ta=new TextArea();
    Button readFB=new Button("Read File");
    TextField tf=new TextField();
    public void init() {
    setLayout(new BorderLayout());
    Panel tempPan=new Panel();
    tempPan.setLayout(new BorderLayout());
    tempPan.add("West", new Label("File Name:"));
    tempPan.add("Center", tf);
    add("North", tempPan);
    add("Center", ta);
    add("South", readFB);
    readFB.addActionListener(this);
    setSize(300, 300);
    show();
    public void actionPerformed(ActionEvent ae) {
    String action=ae.getActionCommand();
    if(action.equals("Read File")) {
    String strFileName=tf.getText();
    BufferedReader br=new BufferedReader(new FileReader(new File(strFileName)));
    ta.setText("");
    String nextLine="";
    while((nextLine=br.readLine())!=null) {
    ta.append(nextLine+"\n");
    br.close();
    ps: be careful when modifying security policy file.
    It will affect all applet code that is loaded from the
    codeBase specified. If no codeBase is specified it
    will apply to all codeBases leaving you vulnerable
    to malicious applets. Good luck.
    </PRE>

Maybe you are looking for

  • How do I contact blackberry/RIM for repairs?

    I've had my blackberry curve 9300 for about 10 months and my trackpad has stopped working.  How do I contact RIM/Blackberry to get this fixed as I am still under warranty? (I live in the uk) Help please as I am without phone at themoment and struggli

  • Shared Library shows as shared but not accessible...progress bar grinds

    I have home sharing enabled and it works great between several computers on my home network.  However the library on 1 machine is shared and the library will show up as shared on the other machines, but when selected the progress bar just grinds for

  • Thunderbolt Ethernet update fail to boot?

    Curious if anyone else applied todays updates to Thunderbolt and are now frozen at the gray boot screen with the apple logo and swirly circle? I'm on an early 2011 MBP running Lion with all the latest patches/software except for the Thunderbolt updat

  • Something wrong with formatting Globals!ExecutionTime: AM becoming A7

    Hello, I am using SSRS 2008 R2 to generate reports. I used the following expression to display date and time: =Format(Globals!ExecutionTime,"MMM dd, yyyy, hh:mm:ss tt") However, I got this: Jul 11, 2012, 11:08:56 A7 What's wrong with it? Why can't I

  • Rmi +codebase

    I�ve a problem connecting my webstart rmi-client to a rmi-server. The webstart rmi client downloads the stubs from the server codebase. So far this is the right behaviour. After that the client tries to download the remote interface from the server c