• 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

Writing and reading a byte file, help

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got a program where i create a byte file (.dat) containing a string. And i got another program where i want to reat the byte file to
see the string.
But when i run the read method i buggs and tells me that the source is not found.

This is the method i use to create the file:



This is the method i use to read the file:



Does anyone know whats wrong?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But when i run the read method i buggs and tells me that the source is not found.


Does this mean there's an exception? If so, can you post the stack trace?
 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm running Eclipse, and there is some information, cant understand what it means tho.

This is what i get in the debug mode that it takes me to when i run the program.

Thread[main] (Suspended (exception EOFException))
DataInputStream.read(byte[], int, int) line: not avalible
DataInputStream.readUTF(DataInput) line: not avalible
DataInputStream.readUTF() line: not avalible
Filer.readBankKvitto() line: 112
Main.main(String[]) line: 86
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Run at the command line, the code works fine for me.
 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i call the method readBankKvitto(), it pops up a debug window, and behind it says
source not found.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When that method is called, does the file exist?
 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The file does exist when the method is called.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic