This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing and reading a byte file, help

 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • 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?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
The file does exist when the method is called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic