Results 1 to 7 of 7
  1. #1
    rykeelty is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Formatter format method output limit?

    I'm on Windows 7 and my Formatter object only wants to write out about 2500 values to file. After that the file is abruptly cut off in the middle of a number, and is just empty after that. I know the while loop is executing the full 4200 times, and iter.next() is returning correct values for all those iterations because I printed them out as it happened. Nevertheless, the actual writing to file part ends after about the 2500th write-out. Any ideas? Thanks! -Ryan

    try{...

    output = new Formatter("C:\\users\\ryans\\desktop\\IntelMA.tsv" );
    ...
    }

    ...

    Iterator<Double> iter = MA.getMovingAverage().iterator();

    while (iter.hasNext()){
    output.format("%f\t", iter.next());
    }

  2. #2
    rykeelty is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Formatter format method output limit?

    And I should probably say that MA.getMovingAverage() returns a List<Double>

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Formatter format method output limit?

    What is the size of the file that is created in bytes?
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    rykeelty is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Formatter format method output limit?

    Thanks for responding. It is 24kb.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,303
    Rep Power
    20

    Default Re: Formatter format method output limit?

    Post your Java version and a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem. You can use Random#nextDouble() to get numbers for formatting so that the program doesn't depend on any other custom class.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    rykeelty is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Formatter format method output limit?

    Thanks for helping, everyone. I added an output.close() to the end of the program and now it works. Apparently the Formatter object needed to flush it's buffer.

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Formatter format method output limit?

    Typical for a sloppy beginner program.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 7
    Last Post: 08-11-2011, 10:06 PM
  2. output format problem.
    By jim01 in forum New To Java
    Replies: 8
    Last Post: 04-18-2011, 09:00 AM
  3. Format the output
    By Moustafa taha in forum New To Java
    Replies: 5
    Last Post: 10-18-2010, 05:01 AM
  4. customize formatter class to take in custom format?
    By diskhub in forum Advanced Java
    Replies: 1
    Last Post: 05-17-2010, 06:50 PM
  5. output for list of names in a format
    By Ms.Ranjan in forum New To Java
    Replies: 7
    Last Post: 06-18-2009, 04:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •