• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bad File descriptor  RSS feed

 
Barry Myer
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I save data to a file using the ObjectOutputStream object I get an exception: Bad file descriptor. What does it mean? How do I correct it?
My try clause is as follows:

try{
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("topScores.txt"));
int x,y;

for(x = 0; x < 10; x++){
for(y = 0; y < 2; y++){
out.writeObject(data[x][y]);
out.close();
}
}
}
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly which line generates the exception?

The writeObject method takes an Object as the input parameter. Is what's stored in data[x][y] a full-fledged Object, or a primitive type like an int or a double?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!