Questions tagged [ioexception]

IOException is the general class of exceptions produced by failed or interrupted input/output operations in several languages, including Java and C#.

IOException is the general class of exceptions produced by failed or interrupted Input/Output operations in several languages, including Java and C# and other .NET languages.

1451 questions
-1
votes
2 answers

Why does my switch statement generates IOException

I have a switch statement: public Player player(Colour colour, ScotlandYardView view, String mapFilename) { switch (typeMap.get(colour)) { case AI: return new RandomPlayer(view, mapFilename); case GUI: …
Arthur Le Calvez
  • 413
  • 2
  • 7
  • 17
-1
votes
4 answers

error with starting cmd in windows using java?

The following method starts the cmd in Windows and it takes a parameter of the command which need to be run. I have tested this method using the following commands: net users and it worked fine and it printed the users accounts. but if I run the…
james
  • 91
  • 1
  • 3
  • 6
-1
votes
3 answers

File Not Found after throws IOException

I get this exception when I try to read from a file: ERROR: Exception in thread "main" java.io.FileNotFoundException: newfile.txt (No such file or directory) at java.io.FileInputStream.open(Native Method) at…
gangwerz
  • 435
  • 2
  • 8
  • 18
-1
votes
1 answer

Need help understanding this code in Java

Now first of all, I would not be asking this is I knew nothing about input and output. I've watched tons of tutorials on PrintWriter, FileInputStream, InputStreamReader and IOException. I understand the concept of these classes. But I just don't…
-1
votes
1 answer

IOException! Connection refused

I am trying to make a function called authenticate, which needs username and password as arguments. The function makes a new thread, posts data to the .php file and returns the result of authentication. The problem that I am facing is that an…
A_Javed
  • 46
  • 8
-1
votes
2 answers

Avoid app crash with IOException or internet is missing

in my app I have to "download" a string from a file and when user disables internet and the app is open with AsyncTask operation it crashes because the internet operation doesn't work and the error flows in IOException catch. I tried to do an…
ClearCode
  • 47
  • 4
  • 11
-1
votes
1 answer

IOexception sending an Object to a server (socket connection)

This is a homework assignment just to clarify. The problem is, I have a client and server connection however I am sending a class I made namely "Course", through to the server over a socket connection (TCP). This is where I am encountering a problem…
Mjall2
  • 253
  • 1
  • 9
  • 24
-1
votes
1 answer

Determine corrupt file of "Data Error (Cyclic redundancy check) on IOException"

Given this code snippet: public IEnumerable GetFiles(string searchPattern) { return this.DirectoryInfo .GetFiles(searchPattern) .Select(fileInfo => new FileInfoWrapper(fileInfo.FullName)); } Suppose that…
HuorSwords
  • 2,225
  • 1
  • 21
  • 34
-1
votes
1 answer

My program skips a BufferedReader making it throw an IOException without prompting me for input

I'm writing a sort of program that records data and exports it to an external file. In my main class, I have this loop that prompts you at the end of the program if you want to restart the program or terminate it. I don't know why though but when I…
Lexicographical
  • 501
  • 4
  • 16
-1
votes
3 answers

Error "unreported exception java.io.ioexception must be caught or declared to be thrown" in Java class

I am getting a "unreported exception java.io.ioexception must be caught or declared to be thrown" for some reason. I throw an I/O exception in this method: private void setChar() throws IOException { try { int…
Surz
  • 984
  • 3
  • 11
  • 36
-1
votes
2 answers

IOException for a BufferedReader

I have to create a reader and to catch an exception if a file cannot be read. The code is something like this: String line; try { while ((line = reader.readLine()) != null) { //DO SOMETHING } } catch (IOException e) { …
-1
votes
2 answers

Can't create a file

I'm trying to create a simple image file on Android and have the two following methods: Creating the directory: private void createThumbnailDir() { File file = new File( …
Tim Kranen
  • 4,202
  • 4
  • 26
  • 49
-1
votes
1 answer

Buffered Image Junit error

I get the following error when I try to load a buffered image in a junit test. Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor The code this affects…
-1
votes
2 answers

java.io.StreamCorruptedException: invalid stream header FFD8FFE0

I'm getting an IOException in my code in the following line ObjectInputStream stream = new ObjectInputStream(new FileInputStream("D:\\K.jpg")); The Exception detail is: java.io.StreamCorruptedException: invalid stream header: FFD8FFE0 at…
Vivek
  • 341
  • 1
  • 5
  • 15
-1
votes
1 answer

IOException with function openStream of class URL

I have an IOException with this function: protected Boolean doInBackground(Object... params) { boolean result = false; String path = (String) params[0]; table = (TableLayout) params[1]; XmlPullParser topScores =…