• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Skipping input and writing to file using FileWriter

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question. This is my first commercial application and I'm having some issues printing four 96 well plates to a text file because I have to point the input stream to the top of the page and ignore the first 41st characters on the same line in order to print plate C. What I'm trying to do will be immediately clear if you see the attachment. I'm processing data from the first plates A and B but having to write B to the right of A and D to the right of C. How would I go about doing this? Eclipse is claiming mark and reset aren't supported by FileWriter, FileReader, etc. I know I could create a temp text file with a and b etc and c and d etc and then merge the two but that doesn't seem like the most efficient/safe option. Plates can go up to Z and AA and etc.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would read in the data and build a page in memory, then write the whole page to the FileWriter. You can put the data into memory in any order you like.
 
montag constantine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would you recommend building it into memory? I was thinking maybe like a string object, like an array of strings I guess? Better idea? I know that the number of lines will always be fixed per plate/page, etc.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An array of strings, one array entry per printed line seems like a good start to me.
 
montag constantine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent. Thanks very much Paul. I'll report back and let you know if I have trouble/luck.
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic