'file' is a string that contains the file name, eg. '/home/shalom/F001.xml'
What type of object is 'file' (the object you are passing to the FileInputStream constructor. Is it a file name, a File object, or a FileDescriptor object?
My gut says the file you are passing in to the FileInputStream constructor is somehow the same as 'stdin', which is confusing java. david
Shalom Carmel wrote: File is a file in IFS. Here is a more complete piece of code. The Java program reads a text file from a directory and places is on a queue (MQ). There is nothing to do with stdin, and sometimes it works. This runs on a OS400 5.4 , JVM 1.4. FileInputStream fstream = new FileInputStream(file); if (fstream.available() > Integer.MAX_VALUE) System.out.println("File '" + file + "' is too big."); int buffersize = fstream.available(); byte contents = new byte[buffersize];; long n = fstream.read(contents, 0, buffersize);fstream.close(); fstream = null; if (n != buffersize) System.out.println("Error in reading file '" + file + "'"); else message = new String(contents);
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.