Need help using JTextArea to read large file

Hi here is the deal.
I've got a large file (about 12Mbytes) of raw data (all of the numbers are basically doubles or ints) which was formed with the ObjectOutputStream.writeInt/writeDouble (I say this to make clear the file has no ascii whatsoever).
Now I do the file reading on a SwingWorker thread where I read the info from the file in the same order I put it originally.
I need to convert it to string and visualize it on a JTextArea. It starts working. However a one point (56% to be exact since I know exactly the number of values I need to read) it stops working. The program doesn�t freeze (probably because the other worker thread froze) and I get no exceptions (even tough I�m catching them) and no errors.
Does anyone have any idea of what the problem could be?
Thank you very much in advance.
PD: I don�t know if it matters but I'm using ObjectInputStream with the readInt/readDouble functions to get the values and then turning them to strings and adding them to the JTextArea.

I can put up the code.
I don't have it with me right now but I'll do it later.
Thank you.
Second. I need to debug a function aproximation that uses a method that has to manage that many numbers. If I don�t put it into a txt and read it there is no way I will know where the problems are, if any. And yes I can look at the txt and figure out problems. It's not that hard.
What I'll try to do is to write directly to regular txt file instead of doing it to the JTextArea.
Thank you for your help and I'll post back with the code and results.
PD: I don't know what profiling is, would you mind telling me?

Similar Messages

  • Need HELP coding Threads to read a file.

    Hello, I am reading an incomming file (from a device called /dev/gps) of latitude and longitude positions. It updates a few times every second, so I would like to read only the last line when the getPosition function is called. Here is a sample of the file being read:
    Latitude: xxxx.xxxxxx,Longitude: -xxxx.xxxxx1
    Latitude: xxxx.xxxxxx,Longitude: -xxxx.xxxxx2
    Latitude: xxxx.xxxxxx,Longitude: -xxxx.xxxxx3
    MY QUESTION:
    how would the code look for a Thread that does the basic reading from my device and update a string variable called currentCoordinates? Then have another thread which is the main program that just reads that variable whenever it's ready for the next coordinate, and it will only read the last value stored in the variable. The first Thread will take care of discarding the unused ones.
    Also, should the updating and reading of the variable should be protected by synchronization?
    thanks for your help!

    Hi, i hope i understood your problem correctly....
    also, im new to threads, so this might not be text book
    Below is the code for 4 classes
    CoordHolder - class that holds the current coord data
    CoordReader - class that reads the file and updates the coordholder when it finds a new line
    CoordUser - class that reads coordholder and gets the coord data
    CoordTest - class to test the above
    When CoordTest is running try changing the text in the file (in this example called output.txt) and you will see the last line output to teh console.
    I think this would also be better done using a javax.swing.timer but the SDK im using doesnt have it.
    Hope this helps a little!!
    public class CoordHolder
         private boolean alreadyRead = false;
         private String coords = "";
         public synchronized void setCoords(String inCoords)
              while (alreadyRead == false)
                   try
                        wait(); //wait for value to be read
                   } catch (InterruptedException e){}
              coords = inCoords;
              alreadyRead = false;
              notifyAll();
         public synchronized String getCoords()
              while (alreadyRead == true)
                   try
                        wait(); //wait for value to ne written
                   } catch (InterruptedException e){}
              alreadyRead = true;
              notifyAll();
              return coords;
         public boolean isAlreadyread()
              return alreadyRead;
    import java.io.*;
    import java.util.*;
    public class CoordReader extends Thread
         private String data;
         private String lastLine = "";
         private String lastLine2 = "";
         private CoordHolder ch;
         private File file;
         private int tick=1;
         public CoordReader(CoordHolder c, String f)
              ch = c;
              file = new File(f);
         public void run()
              while (true)
                   tick++;
                   if ((tick % 500000) == 0)
                        BufferedReader LINE;
                        try
                             LINE = new BufferedReader(new FileReader(file)); //input file handle
                             while((data = LINE.readLine()) != null)
                                  lastLine = data;
                                  //do nothing, get to end of file
                             LINE.close();
                             if (!(lastLine2.equals(lastLine)))
                                  ch.setCoords(lastLine);
                                  lastLine2 = lastLine;
                                  System.out.println("Reader: "+lastLine);
                        }catch(IOException e){System.out.println("ACK! IO problem.");}
                   if (tick>4000000)
                        tick = 1;
              yield();
    public class CoordUser extends Thread
         private CoordHolder ch;
         private String coord;
         public CoordUser(CoordHolder c)
              ch = c;
         public void run()
              int value = 0;
              while (true)
                   coord = ch.getCoords();
                   System.out.println("User: "+coord);
    public class CoordTest
         public static void main(String[] args)
              CoordHolder c = new CoordHolder();
              CoordReader r = new CoordReader(c, "C:\\output.txt");
              CoordUser u = new CoordUser(c);
              r.start();
              u.start();
    }

  • Need help with email transfers of large files WRT160nl

    This is a new router for my home based business network. I am using Windows XP, Vonage, cable, a Dell power connect 2708 to expand ports and the WRT160nl router. Two issues: the most important is that I can no longer email large pdf files (contracts for instance) without breaking them into 6 to 7 Mg size files. Even 10mg files will not go. My previous Linksys wireless router (since 2003) never had this problem. Any ideas? I should also mention that I scan the files before trying to upload via email to clients.
    Also, at least once a day I have to restart my desktop (wireless) because the connection to our server (where all our files are stored) has dropped. I can access the internet and email.  Any ideas?
    Many thanks

    Open the setup page of the router and change the MTU size to 1365. Save the settings.
    Go to Wireless tab and click on Advanced wireless settings sub tab. Change the Beacon Interval to 75, RTS and fragmentation threshold to 2306. Save the settings and power cycle the router. See if that makes any difference.
    Make sure that firmware on your router is upgraded.

  • Need help using adobe digital reader with screen reader software

    I am helping my father, who is blind, and uses Window-eyes screen Reader software, which reads his computer screen to him in an audio voice. We just bought an ebook, downloaded adobe digital reader, but his window-eyes software will not read the book to him when we have it displayed on his computer screen. Is there a solution to this?
    Thanks

    Thanks for the response. So, I see that my answer does not lie with Adobe--I will pursue the solution elsewhere, if anyone here has some further advice as to what the solution is, please let me know.
    Thanks again.

  • HT5622 i need help using the icloud it is not making any since to me can some one call me and help me with it please don't try to help me through email i need to talk and listen i don't understand instruction by reading

    i need help using the icloud it is not making any since to me can some one call me and help me with it please don't try to help me through email i need to talk and listen i don't understand instruction by reading.
    <Phone Number Edited by Host>

    You aren't addressing anyone from Apple here.  This is a user forum.
    You might want to call a neaby Apple store to see if they have a free class you could attend.

  • I need helping using iAds in my application.

    I need helping using iAds in my application. I currently am not using any storyboards. I am using Sprite builder for my UI.
    I attatched an image ot show all the different file name I have.
    Everyone is being used & they all work fully.
    The "iAdViewController.h & .m" files are just example codes I looked up and was messing with so that my iAd can work.

    I wouldn't even be able to use the Mathscript node in an executable? 
    What I am trying to do is make a user configurable data stream. 
    They tell me how many bytes are in the stream and what parameters they
    want to be put in to it.  Currently I have to make vi's that are
    called dynamicaly to make the parameters.   Then recompile
    the code and send it to them.  This is somewhat of how the config
    file is set up so I know how to make the data.
    Data_Type  foo
    Bytes 30
    parameter_name        
    function           
       byte#          format
    sync              
    foo_sync            
    29               int
    time                              
    foo_time             
    1,2,3,4       double
    If I can't use MathScript to allow the user to make there own functions
    is there another way that I might be able to do this so I do not have
    to recompile the code atleast?  Were I might just be able to make
    the new function and send that to them.
    Any Idea would be great.

  • I have over 200 hours of HD video on 5 different TB Thunderbolt GRaid hard drives. I need to reorganize my projects, moving large files from one drive to another. Advice?

    I have over 200 hours of HD video on 5 different TB Thunderbolt GRaid hard drives. I need to reorganize my projects, moving large files from one drive to another. Advice?

    Do some testing to get your method working right with some less than important footage.
    Copy/paste files where you want then.
    Use the FCE Reconnect feature to tell FCE where the newly copied files reside.
    Make sure the new location and files are working as expected with your Projects.
    Delete the original files if no longer required.
    Al

  • File Adapter Not Reading Large Files

    Dear Experts,
    Enviornment :-
    OS:-Linux
    Jdeveloper:- 11.1.1.6
    SOA:-11.1.1.6
    Weblogic:-10.3.6
    JDK:-SUN
    Allocated RAM:-16GB
    Currently we are in UAT Phase and now we are facingan  issue in reading large file.Below is the Design details of the service
    FileAdapter(Read)-->Bpel(Business login,Using FlowN)-->FileAdapter(Write CSV),JMS Adapter(AQ JMS topics)
    In this case at the time of read itself we are facing issue. File adapter reading xml file but in receive activity receives input data as
    xmlDocKey:1C135990067411E3BFA6B5087B629F9DI
    I really couldn;t understand about the error. Even i tried reading as Opaque format and still end up with same error.
    In order to make sure i have create mediator and tried reading the file, in case i was able to read file upto 15mb with out any error.Also i tried as  "read as Attachment" in Bpel component and able to read the attachment upto 7 mb file, but this is hitting the performance side.
    I request some one please let me know why the file adapter is giving XmlDOCKey rather then XMLContent to the inputvariable
    Regards,
    Tarak

    Can you check your BPEL Properties in EM?
    Go to Soa-infra > right Click > SOA Administration > BPEL properties
    increase the Dispatcher Engine Thread = 10, Dispatcher Invoke Threads = 60 and Dispatcher Engine Threads to 90
    Click on "More BPEL Configuration Properties"
    Increase the  DispatcherMaxRequestDepth from 600 to 1000.
    Bounce the server and see if works..
    Bounce the server and try again.
    If this fails, try get a threshold by increasing the file size until it fails again. 

  • Reading large file with JCA Adapter in OSB

    Hello,
    We are searching for a solution how to read large file (>50M) from network drive and deliver it to queue via OSB 11gR4 (10.3.4). The problem is when reading the file with JCA File Adapter. It seems that it cannot handle as large files as we have. The documentation provides a way to bypass file size limitation by using Chunk Read but it seems to require BPEL Process execution which is not possible in our environment. Does anyone know if there are ways to implement this without having BPEL Process?
    Our usecase:
    read file from network drive -> transfer with OSB -> deliver MQ
    Other options than JCA File Adapter can be considered, if anyone can advice...

    If it's a plain routing use case and no message processing is required then you may simply use OSB's FILE transport instead of JCA adapter. Create a messaging type proxy service and select request message type as "binary". Also enable the content streaming (Disk buffer, compression).
    From OSB Dev guide -
    Oracle JCA Adapter for FTP and Files – Attachments (large payload support), pre- and post-processing of files, using a re-entrant valve for processing ZIP files, content streaming, and file chunked read are not supported with Oracle Service Bus.
    http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/jca.htm#BABBICIA
    You may also refer -
    Reading huge flat file in OSB 11gR1
    Regards,
    Anuj

  • I need help with adobe iv reader.

    iam trying to pin a website using ie.it says the reader cannot read the website,i am not computer saavy so i donot know how to fix this issue, pls help,tyvm.

    i am trying to pin a website in internet explorer to my task bar,i get a 
    message that adobe v1 could not decode the website, i am not computer saavy
    so i  don't know what that means,plus this is a new computer 4 me.plus it
    worked fine  a few days ago. tyvm 4 ur help.
    regards,
    ray nist
    In a message dated 6/11/2013 9:27:11 P.M. Eastern Daylight Time, 
    [email protected] writes:
    Re: i  need help with adobe iv reader.
    created by Pat Willener (http://forums.adobe.com/people/pwillener)  in 
    Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/5400013#5400013)

  • Re: Beginner needs help using a array of class objects, and quick

    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ? In html, I assume. How did you generate the html code of your three classes ? By help of your IDE ? NetBeans ? References ?
    I already posted my question with six source code classes ... in text mode --> Awful : See "Polymorphism did you say ?"
    Is there a way to discard and replace a post (with html source code) in the Sun forum ?
    Thanks for your help.
    Chavada

    chavada wrote:
    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.You think she's still around almost a year later?
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ?Just use [code] and [/code] around it, or use the CODE button
    [code]
    public class Foo() {
      * This is the bar method
      public void bar() {
        // do stuff
    }[/code]

  • Hi there, I need to be able to read raw files from an Olympus Stylus 1 via CS5 and Lightroom 4.  I have downloaded Raw file plug-in v 6.7.1 but still can't read the files.

    Hi there, I need to be able to read raw files from an Olympus Stylus 1 via CS5 and Lightroom 4.  I have downloaded Raw file plug-in v 6.7.1 but still can't read the files?

    Read this table http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    The Olympus Stylus 1 was first supported in Camera Raw 8.3 which is only compatible with CS6 and CC.
    It is not compatible with CS5 or older and never will be.
    If you do not want to upgrade to CS6 or CC then you can dwonload the free Adobe DNG converter, convert all Stylus 1 Raw files to DNGs then edit the DNGs in CS5.
    Camera raw, DNG | Adobe Photoshop CC

  • Elements 9 failure to read large files.

    I recently purchased a Nikon D5300. I was a previous D50 user and always saved and converted RAW NEF files with Elements 9. The D5300 save 24Mb NEF files and Elements 9 would not read these files. I chanded to save RAW and JPEG files and it would not read those either. It will read lower res JPEG files. Is there an update to Elements 9 to alllow reading larger files?
    Bob Jacobson
    [email protected]

    Here's an interesting take on the "dependent operation failure" error message
    Adobe CS5: Payload cannot be installed due to dependent operation failure

  • Need help using dbms_scheduler to submit an immediate job on the database

    Hi. I need help using dbms_scheduler to submit an immediate job on the database. Essentially I want to issue a one-time call to an Oracle Stored Procedure - this procedure will then send an email. I've never used dbms_scheduler before, but here's what I have so far.
    So my Program is a stored database procedure named 'TTMS.dropperVacationConflict_Notify', but my problem is that I need to pass 3 parameter values to this job each time I run it. This is what I can't figure out. The procedure expects an 'Id' as number(5), begin_dt as a date, and end_dt as a date.
    How do I pass these values when I run my job? Can anyone help?
    begin
        dbms_scheduler.create_program(program_name=> 'PROG_DROPVACCONFLICTS_NOTIFY',
         program_type=> 'STORED_PROCEDURE',
         program_action=> 'TTMS.dropperVacationConflict_Notify',
         number_of_arguments => 3,
         enabled=>true,
         comments=> 'Procedure to notify PCM of a Dropper Vacation Conflict. Pass in Dropper Id, Begin_dt, and End_dt');
    end;
    begin
        dbms_scheduler.create_schedule
        (schedule_name=> 'INTERVAL_EVERY5_MINUTES',
         start_date=> trunc(sysdate)+18/24,
         repeat_interval => 'freq=MINUTELY;interval=5',
         end_date => null
         comments=> 'Runtime: Every day all 5 minutes, forever'
    end;
    begin
        dbms_scheduler.create_job
        (job_name => 'JOB_DROPVACCONFLICTS_NOTIFY',
         program_name => 'PROG_DROPVACCONFLICTS_NOTIFY',
         schedule_name => 'INTERVAL_EVERY5_MINUTES',
         enabled => true,
         auto_drop => true,
         comments => 'Job to notify PCM of Dropper Vacation Conflicts'
    end;
    /And I use this to execute the job as needed...
    begin
        dbms_scheduler.run_job('JOB_DROPVACCONFLICTS_NOTIFY',true);
    end;
    /

    Duplicate Post
    Need help using dbms_scheduler to submit an immediate job on the database

  • Reading large files -- use FileChannel or BufferedReader?

    Question --
    I need to read files and get their content. The issue is that I have no idea how big the files will be. My best guess is that most are less than 5kb but some with be huge.
    I have it set up using a BufferedReader, which is working fine. It's not the fastest thing (using readLine() and StringBuffer.append()), but so far it's usable. However, I'm worried that if I need to deal with large files, such as a PDF or other binary, BufferedReader won't be so efficient if I do it line by line. (And will I run into issues trying to put a binary file into a String?)
    I found a post that recommended FileChannel and ByteBuffer, but I'm running into a java.lang.UnsupportedOperationException when trying to get the byte[] from ByteBuffer.
    File f = new File(binFileName);
    FileInputStream fis = new FileInputStream(f);
    FileChannel fc = fis.getChannel();
    // Get the file's size and then map it into memory
    int sz = (int)fc.size();
    MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
    fc.close();
    String contents = new String(bb.array()); //code blows up
    Thanks in advance.

    If all you are doing is reading data I don't think you're going to get much faster than InfoFetcher
    you are welcome to use and modify this class, but please don't change the package or take credit for it as your own work
    InfoFetcher.java
    ==============
    package tjacobs.io;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    * InfoFetcher is a generic way to read data from an input stream (file, socket, etc)
    * InfoFetcher can be set up with a thread so that it reads from an input stream
    * and report to registered listeners as it gets
    * more information. This vastly simplifies the process of always re-writing
    * the same code for reading from an input stream.
    * <p>
    * I use this all over
         public class InfoFetcher implements Runnable {
              public byte[] buf;
              public InputStream in;
              public int waitTime;
              private ArrayList mListeners;
              public int got = 0;
              protected boolean mClearBufferFlag = false;
              public InfoFetcher(InputStream in, byte[] buf, int waitTime) {
                   this.buf = buf;
                   this.in = in;
                   this.waitTime = waitTime;
              public void addInputStreamListener(InputStreamListener fll) {
                   if (mListeners == null) {
                        mListeners = new ArrayList(2);
                   if (!mListeners.contains(fll)) {
                        mListeners.add(fll);
              public void removeInputStreamListener(InputStreamListener fll) {
                   if (mListeners == null) {
                        return;
                   mListeners.remove(fll);
              public byte[] readCompletely() {
                   run();
                   return buf;
              public int got() {
                   return got;
              public void run() {
                   if (waitTime > 0) {
                        TimeOut to = new TimeOut(waitTime);
                        Thread t = new Thread(to);
                        t.start();
                   int b;
                   try {
                        while ((b = in.read()) != -1) {
                             if (got + 1 > buf.length) {
                                  buf = IOUtils.expandBuf(buf);
                             int start = got;
                             buf[got++] = (byte) b;
                             int available = in.available();
                             //System.out.println("got = " + got + " available = " + available + " buf.length = " + buf.length);
                             if (got + available > buf.length) {
                                  buf = IOUtils.expandBuf(buf, Math.max(got + available, buf.length * 2));
                             got += in.read(buf, got, available);
                             signalListeners(false, start);
                             if (mClearBufferFlag) {
                                  mClearBufferFlag = false;
                                  got = 0;
                   } catch (IOException iox) {
                        throw new PartialReadException(got, buf.length);
                   } finally {
                        buf = IOUtils.trimBuf(buf, got);
                        signalListeners(true);
              private void setClearBufferFlag(boolean status) {
                   mClearBufferFlag = status;
              public void clearBuffer() {
                   setClearBufferFlag(true);
              private void signalListeners(boolean over) {
                   signalListeners (over, 0);
              private void signalListeners(boolean over, int start) {
                   if (mListeners != null) {
                        Iterator i = mListeners.iterator();
                        InputStreamEvent ev = new InputStreamEvent(got, buf, start);
                        //System.out.println("got: " + got + " buf = " + new String(buf, 0, 20));
                        while (i.hasNext()) {
                             InputStreamListener fll = (InputStreamListener) i.next();
                             if (over) {
                                  fll.gotAll(ev);
                             } else {
                                  fll.gotMore(ev);
         }

Maybe you are looking for