read « binary File « Java I/O Q&A





1. Best way to read structured binary files with Java    stackoverflow.com

I have to read a binary file in a legacy format with Java. In a nutshell the file has a header consisting of several integers, bytes and fixed-length char arrays, followed ...

2. Java : Reading in a binary file    stackoverflow.com

I have an program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. Then ...

3. Problem with reading binary file to a deque    stackoverflow.com

I'm writing a deque implementation with ArrayList as required by my instructor. So far the body of the class looks like this

try {
        while ...

4. How to read content of .EXE file in Java    stackoverflow.com

What are the possible options and the most appropiate for reading an executable file in Java. I want produce the hexadecimal representation of an .exe file. Im thinking of reading the file ...

5. reading buffered binary file (with seek)    stackoverflow.com

Say I need to read huge binary file of integers, a handy way is:

FileInputStream fi = new FileInputStream(file);
BufferedInputStream bi = new BufferedInputStream( fi); 
DataInputStream di =new DataInputStream(bi);
But now say ...

6. Read binary file backwards using Java    stackoverflow.com

I'm reading in binary files normally using:

//What I use to read in the file normally
int hexIn;
for(int i = 0; (hexIn = in.read()) != -1; i++){
}
What I need to do is read ...

7. Read binary file backwards using Java    stackoverflow.com

I hope you can help me I have been trying for about 5 hours now to do this ha ha. What I need to do is read in a file backwards. ...

8. Reading a binary file in Java    stackoverflow.com

I'm not new to Java, which perhaps only adds to the awkwardness of having to ask this question, but here goes. I have a comparatively long file of unsigned integers (64 ...

9. Reading integer values from binary file using Java    stackoverflow.com

I am trying to write values greater than 256 using DataOupPutStream.write() method. When i try reading the same value using DataInputStream.read() it will return 0. So, i used DataOutputStream.writeInt() and DataInputStream.readInt() ...





10. how can i read from a binary file?    stackoverflow.com

I want to read a binary file that its size is 5.5 megabyte(a mp3 file). I tried it with fileinputstream but it took many attempts. If possible, I want to read ...

11. Read VB 5.0 binary files with Java    stackoverflow.com

I have a binary file that is created from a program made in Visual Basic 5.0. The file just contains a bunch of Long values from the Visual Basic world. I've ...

12. How to read binary file until the end-of-file?    stackoverflow.com

I need to read binary file including the eof. I read file using DataInputStream

DataInputStream instr = new DataInputStream(new BufferedInputStream(new FileInputStream( fileName ) ) );
And I used readInt(); to read binary ...

13. Read binary file    stackoverflow.com

I need help with an issue that i have. I want to read a binary file. The content of the file are: 0000000010001100 I'm using the following code to reach my goal:

InputStream is = new ...

14. getting wrong values while reading Double from binary file in java    stackoverflow.com

RandomAccessFile in = new RandomAccessFile("BOT.grd", "r");
in.seek(28);
double xll=in.readDouble();
The above is the code i am using to read double data which is present from 29 to 36 byte location.The value present is 500 ...

15. Java Binary type in file    stackoverflow.com

I have a problem with binary type. I have binary file with data. Every element is split by "_". I am using
DataInputStream in = new DataInputStream(new FileInputStream("C:/Data/"+names)); , where names ...

16. reading unix binary file    coderanch.com

I have a binary file not created by Java. I want to be able to read it from my Java application. Does anyone have any suggestions on which file stream I should use? I am currently using the DataInputStream. I'm having an endian problem. Does anyone have a routine to switch the between big and little endian in Java? [This message ...





17. How to read binary file?    coderanch.com

18. reading binary file in java    coderanch.com

By the use of struct in your initial post, I assume the file is written by a program written in C or C++. One problem you will encounter is that the struct definition still doesn't tell us what the format of the file is. Do you know exactly how the fields for this struct were written to the file? Can you ...

19. reading binary file in java(with code also)    coderanch.com

Here is my c++ program #include #include using namespace std; struct cdata { char tcode[6]; char ttype[1]; char fname[12]; char lname[14]; char ipur[52]; char ipri[5]; char tdate[8]; }data; int main() { char choice='Y'; ofstream out("DataFile",ios: ut|ios::binary); if(!out) { cout<<"can not create data file\n"; exit(1); } while(choice=='Y') { cout<<"Enter transation code:"; cin>>data.tcode; cout<<"Enter transation type:"; cin>>data.ttype; cout<<"Enter First Name:"; cin>>data.fname; cout<<"enter last ...

20. Reading a binary file    coderanch.com

Hi, I have a file that I'm trying to read with Java. The file is binary set of records of fixed length, and each record is just a list of doubles. The only catch is that the file was created as output from a Fortran-77 program compiled and run on a UNIX machine, and I'm not sure how to deal with ...

21. reading from a binary file    coderanch.com

Hi, I'm trying to write to and then read from a binary file. I have 2 .java files. The first one writes to and the 2nd one reads from. I wrote to the file and now I'm testing my read program and here's the output i'm getting... I should say that there should be 4 fields printing out: state, an int ...

22. Best way to read large Binary Files    coderanch.com

23. Reading a field in a Binary file    coderanch.com

Can we get a field in a binary file without reading the whole line..? For example, I have a binary file, and one "line" or record have 10 integers on it.. In my code I use this: FileInputStream file_in = new FileInputStream (myfile); DataInputStream in = new DataInputStream (file_in); int [] line = new int[10]; // one "line" would have 0-9 ...

24. Help to read binary files    coderanch.com

Hi All, Actually I have a binary file in which Binary fields are stored in LSB_LO format. So, can anyone please tell me how can I read this file and how can I convert this file in to normal string presentation? I have tried to read file with FileInputStream. Then I getBytes() from that file and after getting bytearray I converted ...

25. Help required to read binary file    coderanch.com

Hi, I am trying to read a binary file in java , which i get from a vendor who uses C++ to generate these files. So these files are ofcourse in little endian format. Have been successful in reading some parts of this file but one part of file as 32bytes Char data. I am not sure how to read all ...

26. read binary file with header    coderanch.com

28. Read binary files    java-forums.org

I am strugg Write a program that reads a binary file of integers between 0 and 100, and prints: the largest number in the file; the smallest number in the file; the average of all the numbers in the file. The program should obtain the file name form the user (the command line). Could someone please help with this? I have ...

29. Reading Binary File using java    java-forums.org

Hi, I am trying to read a binary file using java and I am getting weird results. I will explain the background a little better. I am working on a legacy system called Advantage Plus and it's database is called Metropolis. The Metropolis database is very similar to mainframe VSAM file (if you know about VSAM KSDS). Each database contains a ...

30. reading a from a binary file    java-forums.org

Java Code: //this is the function i am using to save 8 integer values to a file public void export_file() throws IOException { File file = null; //create a new file if (file == null) { file = new File("Project.mxi"); } try { FileOutputStream f_out = new FileOutputStream (file); DataOutputStream d_out = new DataOutputStream (f_out); for (int i=0;i <= 8; i++) ...

31. How can I read a binary file record by record in java?    java-forums.org

I want to fetch a binary file from server and read its records. The binary file is made in Delfy by defining a record type: My_Record_Type = packed record x,y : word; a,b; byte; end; The only way I have found to read this in Java is by wrapping the InputStream with a DataInputStream and read the records by using 2*readChar ...

32. reading integers in a binary file    forums.oracle.com

33. reading from a binary file    forums.oracle.com

34. Read / Process a binary raw data file.    forums.oracle.com

I get a raw data file from a server, containing information in binary form. I need to generate a XML using the raw data. I managed the XML part but raw data is making me nuts. Can anyone suggest how should I go about reading the data from binary raw data file. regards

35. seeking a read binary file example    forums.oracle.com

It is a Readers job to bridge the gap between a binary stream and character data. See the API for Reader, InputStreamReader, and BufferedInputStreamReader (I do not have access to the links right now). Just noticed you are using an DataInputStream - are you sure that is what you want? Message was edited by: jbish

36. read binary file in java    forums.oracle.com

37. Binary file reading confusion    forums.oracle.com

I'm trying to read a partially binary file with the following structure: The first three lines of the file are regular strings (one can see them correctly when opening the file in a text editor), the rest of the file's contents are integers in their binary form (one cannot see them correctly when opening the file in a text editor). How ...

38. Reading in a binary file!    forums.oracle.com

39. OutOfMemoryError when reading binary file    forums.oracle.com

I'm encountering an OutOfMemoryError when attempting to read a reasonably large (about 135MB) binary file in to memory, but I think I should have plenty of space. Here's the code I'm running: private void loadFile(String file) throws IOException { RandomAccessFile r = new RandomAccessFile(file, "r"); int length = (int) r.length(); System.out.println("" + length); // Prints 140697216 byte bytes[] = new byte[length]; ...

41. Reading Binary File    forums.oracle.com

42. How to read non-java binary file?    forums.oracle.com

Hello Team, I have problem to read non-java binary file. Let me explain.... I have one binary file created in vc++ having fix structure. Structure of file is like String,int,int,int. Now I have to read this file in my java application. I am failed to identify length of String value of Structure in java. Can any body help me to solve ...

43. Reading Integers from a binary file    forums.oracle.com

i am having a bit of trouble reading integers from a binary file... reading one byte or a few separately is fine and printing them out, etc.. raf.seek(28); byte [] buf = new byte[4]; raf.read(buf); System.out.print(buf[0]); System.out.print(buf[1]); System.out.print(buf[2]); System.out.print(buf[3]); however i want to read all four bytes as one integer, i.e 4194304 (signed 32 when selecting the 4 bytes in a ...

44. A Weird Problem with Reading a Binary File    forums.oracle.com

45. How to read a binary file    forums.oracle.com

All I know about the file is that each line contains a list of fields and I know the length of each field. For example : Each line may have the following format : name - 20 chars id - 4 bytes of binary data address - 30 chars ..... all the lines have the same format.

46. how to read data in binary form from file?    forums.oracle.com

47. reading binary files    forums.oracle.com