Two Laptop Bag*
The moose likes Beginning Java and the fly likes Writing and reading a byte file, help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Writing and reading a byte file, help" Watch "Writing and reading a byte file, help" New topic
Author

Writing and reading a byte file, help

Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
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
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
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?


Ping & DNS - my free Android networking tools app
Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
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
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
Run at the command line, the code works fine for me.
Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
When i call the method readBankKvitto(), it pops up a debug window, and behind it says
source not found.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
When that method is called, does the file exist?
Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
The file does exist when the method is called.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing and reading a byte file, help