read 8 « Operation « Java I/O Q&A

Home
Java I/O Q&A
1.API
2.batch File
3.binary File
4.class file
5.CSV file
6.deploy
7.Development
8.directory
9.error
10.Excel File
11.File Attribute
12.jar
13.Log
14.Media File
15.nio
16.Operation
17.PDF file
18.PropertyFile
19.serialize
20.text file
21.Windows
22.XML file
23.Zip
Java I/O Q&A » Operation » read 8 

1. Reading a gzipped file    forums.oracle.com

This may have something to do with it. You are opening a (binary) gzip file, and then wrapping it with a Reader (which is for reading character-based streams) without specifying the character set, so it is using the default, whatever that is. It may be the case that the stream, although text (even though all streams are binary under the covers), ...

3. Read FileMaker files    forums.oracle.com

4. Read file, specific column and alter it later    forums.oracle.com

Hi All, Can anyone help me? I need to read a txt file and get some data from a specific column, and later check into database, and with that information, I need to alter that line in the same txt. I know how to connect to database, and read a line, but nothing more. Do anyone have any example? I would ...

5. Reading large data file of 10 GB    forums.oracle.com

Hi , How to read a 10GB file and load the data in file to a JTable . I knew that JVM can't handle data more than 1.5 GB . So i thought of using the Java class RandomAccessFile for reading purpose . Even after reading the file , i have to display the contents of file in a JTable. How ...

6. read a Double from a File    forums.oracle.com

I agree with all the others, scanner is the better tool here. I said so [over in your JavaRanch thread.|http://www.coderanch.com/t/457335/Java-General/java/read-Double-from-File] svpriyan00, It is usually best to stick with one forum when posting, to prevent duplicating work. When you do post in multiple forums you should provide links back and forth between them so everyone knows what is being said. You should ...

7. Problem reading Integer values from file.    forums.oracle.com

You need to distinguish between binary data and text. (And read [this excellent introduction into Unicode|http://www.joelonsoftware.com/articles/Unicode.html] to learn how they relate to each other). Then you need to remember these simple rules: - When handling binary data, you will want to use byte/byte[]/InputStream/OutputStream - When handling text data, you will want to use char/char[]/String/Reader/Writer In your case you're handling Text (even ...

8. Reading a file behaving differently on Vista?    forums.oracle.com

I've been using the following code for a while now to read a file into a byte array: FileInputStream stream=new FileInputStream(file); byte[] bytes=new byte[(int) file.length()]; stream.read(bytes); This works perfectly well on Windows XP, Mac OS X and Ubuntu. However, it seems that sometimes the operation fails on Windows Vista. I know the common way is to have some array with a ...

9. Java how to read a .mdb file    forums.oracle.com

As far as I know there are not Type 4 drivers for MS Access, mainly because MS Access has no network protocol. Type 2 drivers would be possible, but I don't think they exist (at least not for free). The main problem about MS Access is that it does a pretty lousy job at being a database. It's better suited as ...

10. Reading file into a string?    forums.oracle.com

11. Reading file, FORTRAN 77 UNFORMATTED    forums.oracle.com

Oh ok, i understand now.. i meant to include the the last println a \n to break up the grouping. But that doesn't matter because your not getting the output that you want. Let me do some research on your question and I'll get back to you. Do you think that it's because your storing the information in a bytearray? have ...

12. Reading from a file    forums.oracle.com

Hi... I am facing some problem in reading contents of a file.... The contents of the file are: 14 1 3 1 4 2 6 2 12 . . . 14 13 int a; FileInputStream fin; fin = new FileInputStream("file.txt"); Now I am reading the first line (i.e. 14) using the command 'a = fin.read()'. But if I print this, it ...

13. How to read big size file?    forums.oracle.com

Either you need to give it more memory, or process the data more efficiently or both. To process the data more efficiently you need to process it progressively (as you read it) As @flounder This means instead of building a List, you have process each line (do what every you are going to do with the data) and then discard it. ...

14. How to read properties in the same order as specified in file?    forums.oracle.com

Also note that your keys will be Strings, so when you use the TreeSet (or other sorted collection) you will get the Strings in alphabetic order, not order that they are read. Which means the input you provided will likely come out like: P10 P2 P3 P4 etc... Why do you need to get them out in order? If you truly ...

15. wants to read file data    forums.oracle.com

Hi, i have file which contains header information and textual information as its data. header syntax is as follows: Its like key value pair. now i want to read this header content which is wriitten at the first line of every file and wants put value in a proper key variable. how can i do this

16. Failed to read the all contents from a file of remote machine    forums.oracle.com

Now, I am able to connect to that server, complete the authentication process, go to particular file and get the contents to InputStream. But problem is with the getting the contents, it failed to get the all ontents of file.sometimes it able to get all contents and sometime it getting only few lines. Donno why it is happening so...Here is the ...

17. Reading from file question    forums.oracle.com

There is no built in method to do this. You can either invest some time into learning about regular expressions or just write a method that iterates over your string char by char. As long as you are reading letters append them to some temp variable, as soon as you encounter a number save that temp variable somewhere and swap over ...

18. Reading from file    forums.oracle.com

for (int count=1; count <=3; count++) { linRead = r1n.next(); System.out.println (linRead); } OUTPUT WHEN RUN Maximizor 50 50 Robinator the problem is i get "Robinator" on the 3rd loop. How do i code it so that my output looks like this and i've already tried letting it only run twice but that didn't work. Maximizor 50 50

19. read a file in java    forums.oracle.com

private boolean inputFile; private RandomAccessFile file; private long position; private char buffer; BufferedReader br; /** * Text File constructor. Open a file for reading, or create * a file for writing. If we create a file, and a file already * exists with that name, the old file will be removed. * @param filename The name of the file to read ...

20. reading data from a file    forums.oracle.com

I added those and it says that the file exists though the rest are false: java.io.FileNotFoundException: C:\data.txt (The system cannot find the file specified) File C:\data.txt is regular file: false File C:\data.txt is readable: false at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:106) at client.ClientMain.main(ClientMain.java:28) Couldn't get I/O for the connection to: localhost Java Result: 1

21. Reading a file    forums.oracle.com

Hi Guys, Iam trying to read a file from a directory as follows: String name = new String(filePath + fileName + ".apr"); File file = new File(name); My problem is that the file extension ".apr" could be in any case(For Example:- "apr","APR","Apr") So my reading of the file fails if the file extension differs from ".apr" to any of the extension ...

23. Read character by character from a file    forums.oracle.com

Dear Experts I want to read a file character by character. I would appreciate if anyone will let me know if there is a function like fgetc (of C programming language) or cin.get (like c++) I would also be interested in reading a file word by word like the cin.get(temp,' ') // delimited by space I would appreciate your help in ...

24. Reading a file that includes apostrophe    forums.oracle.com

25. Reading a file using BufferedReader/StringTokenizer    forums.oracle.com

hi all, i am trying to read a file using BufferedReader and StringTokenizer. The file contains a line as follows, "ABC", "ABC", "ABC", 1, 2, 3 now when i printout st.sval it only prints out the stuff within the quotes and null for the nos. how should i pick up the nos as well. pls help. thanks.

27. how can I read unknown file structure ?    forums.oracle.com

CSMSData 0 6 6 3 6 8 1 A 1 1 / 2 7 / 2 0 0 8 1 2 : 0 3 : 1 2 sender no. 6 6 3 6 8 1 message: A date and time:1 / 2 7 / 2 0 0 8 1 2 : 0 3 : 1 2 each line a ...

28. How to read a file in another location using Java ?    forums.oracle.com

Hi all, i suppose the below code reads my file 'ridata.dat' when it is in the same folder as my java class file. How can i read it from a different location? ---------------------------------------------------------------FileRead.java--------------------------------------------------------------- import java.io.*; class FileRead { public static void main(String args[]) { try{ // Open the file that is the first // command line parameter FileInputStream fstream = new ...

29. Java in Vista: Reading from a file    forums.oracle.com

Help people, I am trying to program a java game but because I have vista installed an error is occurring which doesnt occur when I run the program in linux or XP. All I am trying to do is read from a file. I mean there is nothing wrong with the code except when I run it in a system that ...

30. File Reading Specific Patterns    forums.oracle.com

OK. I know a little about file reading but not much. I have a file that has rows of different values, not all the same. Something like this: Integer_____Integer_____String_____Double ... Currently they are spaced with a tab. What I want to do is to take a value from a int specified line and access either the 2nd or 3rd, etc value. ...

31. Reading a Java File    forums.oracle.com

Hi eveyone I have a question regarding reading a file. I need to output how many times the numbers appear into a label box ex: the number 6 appeared 3 times".Right now my code just finds the sum of all numbers (did that to try it) I can not figure out how to count the number of each number. thanks volunteers ...

32. Kanji characters reading from a file    forums.oracle.com

My resource bundle contains data in the following format worksheet_MyTemplates =}C ev[g worksheet_Refresh =XV worksheet_Submit =M worksheet_Prev =O worksheet_Next = worksheet_Search = After reading from the resource bundle i need to convert that kanji string to escape sequence(\uXXXX). By passing stand alone string to utility class i am able to generate escape sequence. But dynamically after reading from resource bundle,i need ...

33. Reading Data From Document File    forums.oracle.com

34. Reading from a file    forums.oracle.com

Your exception catch blocks are a bit anemic in that you may wish to print the exception's stacktrace rather than just printout "file not found". You would do well to go through the basic IO tutorial on the Sun site to read up on how to do text file input and output. Good luck.

35. Reading growing files    forums.oracle.com

Consider the file as an external resource. One should never keep an open connection to an external resource. In other words, read the resource and then go back and check the size and last modified dates of the resource. If they have changed, notify the user as necessary and re-read the resource. Will save you an enormous amount of flailing around ...

36. Similar technique to .hasNext() for reading in multiple files?    forums.oracle.com

Hi, if I want to point to a directory and have a java app go through each of the files one by one to rename them according to a naming scheme (e.g. newFile1, newFile2,...), is there a technique similar to Scanner's hasNext method to navigate through the files and know when to stop? I haven't been able to find much while ...

37. why I can't read a file?    forums.oracle.com

38. Read a file using java    forums.oracle.com

sorry for the unrelated nitpick, but please avoid unnecessary abbreviations in your posts here. I recommend this for several reasons: 1) Programming is an exercise in precision. When you communicate here (or anywhere) about programming issues and questions, you want this communication to be as clear as possible to avoid any chance for ambiguity. I'd say at least half the answers ...

39. Read a file from the middle    forums.oracle.com

Hi All, i used LineNumberReader class and set the line number to 3, then i used readline... the o/p Readline is the first line of the file ... I think it has to give the o/p of line 3.... The file has more than three lines any Comments is appreciated .. Im confused -Shasi

40. how to read an xlm file in java    forums.oracle.com

My java code is checking some condition and if it fails it is sending a mail which is currently hard coded in the java code. The mail will have static as well as runtime values .............I want to move the static contents of mail from java code to an xml file ........then i want to read the static contents from the ...

41. reading a large file in parts    forums.oracle.com

42. How to read .DAT file in java    forums.oracle.com

Hello, My code to read .DAT file gave me incorrect result. My .DAT file is having record with three columns (zip, latitude, longitude). When I read this .DAT file in DELPHI, giving correct result but not in java. I have given my java code below, File f = new File("c:/ZipTile.dat"); FileInputStream file_input = new FileInputStream (f); DataInputStream data_in = new DataInputStream ...

43. File reading    forums.oracle.com

Let's say that I wanted to create a GUI that could read a series of .txt files (each one representing an item) and additionally read more information from that same file if needed to display if selected from a list. Conceptually, what is the most effective way to go about this? If each Item is to be an object, how should ...

44. i need help to read the contents files EBCDIC    forums.oracle.com

Hello everyone, i have the following problem and hope you can help me, the mainframe sends a few reports to a certain folder, the reports are written in EBCDIC format, which I have to do is making a program in java that reads the files (reports) in this folder and eliminate some reports according to certain string, text, in its content ...

45. How to read contextpath in XSL files    forums.oracle.com

46. Reading from files    forums.oracle.com

Below is the code I am using to try this out. I am able to output the contents of a text file but not the pdf. Is this because I am using the wrong file reader or is it because PDFs like Doc files have formating, font types etc which txt files do not and therefore Java cannot read them? I ...

47. Problem Reading in File (Extra Chars?)    forums.oracle.com

48. Detecting Junctions when reading a file system    forums.oracle.com

I'm writting a program that compares to physical disk drives to ensure backups have restored correctly, but I'm hitting a problem on Vista whereby junctions appear as real files (the absolute and canonicle paths return the same value) and result in recursive looping behaviour. I've seen the same thing happen in some older Windows programs so I guess Java is not ...

49. read packets from a file    forums.oracle.com

Your hunch is correct. The offset and len parameters to FileInputStream refer to the destination array (you could read characters into the middle of an existing array). So in your case they should be 0 and 60000 respectively (or alternatively the read(byte[]) form of the method). The array index out of bounds exception occurs upon the second read because the offset ...

50. How to read file to CLOB    forums.oracle.com

51. How to Read a Portion of a File    forums.oracle.com

i am having data like this..from this i would like to read from Date to Bad Name of The project Aster Location Hyderabad Employee name Praveen kumar Site name VTSL Emp ID 1478 Type of site Demo Team member details period from 11-03-2008 To 15-05-200 1 Kiran 4 Sridhar Total no of Days 24 2 Bharath 5 Shankar 3 Damodar 6 ...

52. Reading a fixed width file..    forums.oracle.com

hi, i am new to java. Could you pls tell me how to read a fixed width file and then insert its contents into a table in the database. Is it possible if i keep a track of start position and end position of various field in the file? for example if a file has fields like xxx(10 characters), yyy(1000 characters)zzz(100 ...

53. How can i read data from a file every 10 seconds using java???    forums.oracle.com

I am using different java programs to wite to text file.Now I want to read data from this file every 10 seconds while the java programs are still copying to file i.e. if after first 10 seconds the data is read then after another 10 seconds that data should be ignored and the rest of the data should be read.Also, remember ...

54. file reading problem    forums.oracle.com

55. read all attributes of a file    forums.oracle.com

Hello, I am about to read with a Java program all attributes of a file. These are e.g. Name of the user, modify Date, create date, so every Attributes which a file has. With the class "file" it was not possible. Where are in JAVA the necessary classes for this? Thanks at advance Gruss

56. Reading from a file    forums.oracle.com

My addEdge method looks like: public void addEdge(int start, int end, int weight, String line) { adjacentMatrix[start][end] = weight; edgeLine[start][end] = line; } as the information in my read file will look like, for example: 1, 2, 3, England 2, 3, 5, Scotland ... ... Can anyone recommend a way of how i can read this into my source code?

57. How to Read a File Inside some Package?    forums.oracle.com

58. How to read File Header in JAVA    forums.oracle.com

I wanna upload a(doc/pdf) file from client site, where I hv to check whether the the file is originally a doc/pdf file or not, I mean not just the extension, but the actual header information of the file. Please some body help me to do this, I dont know how to read the file header. Thnx in advnc.

59. Read HTML file with default browser    forums.oracle.com

Hey, I am working now on Java application and I want it to open HTML file during its run. I can open it with the JEditorPane but it's not supporting everything like a browser, so I prefer to open it with my default browser. BTW, I am working with Windows XP. Can you please tell me how can I do that? ...

60. Reading falat file data.    forums.oracle.com

Hi 233333|45GH5|188618|||SJU34343A|SJ3443391AA|52HV3KSM|564011089022|001D312||||44592984|44592985 above mentioned one is my flat file data. my code is package com.examples; import java.io.*; public class FileDemo { String strPack_Array[ ] = new String[16]; String strElement = null; public static void main(String args[]) { try { FileReader fis= new FileReader("ganga.txt"); BufferedReader bf = new BufferedReader(fis); String str = bf.readLine(); FileDemo f1= new FileDemo(); f1.validateRecord(str); } catch (Exception e) ...

61. Problem in reading data of a file    forums.oracle.com

try{ PdfWriter.getInstance(document,new FileOutputStream("D:\\Kiran HelloWorld.pdf")); document.open(); while((strLine=br.readLine())!=null) { if (strLine.length()>0) //System.out.println(strLine); switch(i){ case 0: if(strLine.startsWith("FAX")){ System.out.println(strLine); document.add(new Paragraph(strLine)); } case 1: if(strLine.startsWith("Sent")){ System.out.println(strLine); document.add(new Paragraph(" ")); document.add(new Paragraph(strLine)); } case 2: if(strLine.startsWith("Time")){ System.out.println(strLine); document.add(new Paragraph(" ")); document.add(new Paragraph(strLine)); } case 3: if(strLine.startsWith("Date")){ System.out.println(strLine); document.add(new Paragraph(" ")); document.add(new Paragraph(strLine)); } case 4: if(strLine.startsWith("Quantity")){ System.out.println(strLine); document.add(new Paragraph(" ")); document.add(new Paragraph(strLine)); } case 5: if(strLine.startsWith("FROM")){ ...

62. reading the contents of a COD file    forums.oracle.com

63. Reading data from a file ???    forums.oracle.com

64. RAR File Read    forums.oracle.com

65. Separating a date read in from a file...    forums.oracle.com

I have a file which contains dates of birth in the form of 3 integers on each line, if I want to read in this line from the file and separate each (day,month,year), what is the easiest/best way to do this? The 'day' part of the date can either be stored as 1 or 2 digits depending on the date, same ...

66. help me to read from a file    forums.oracle.com

67. Continuous file reading    forums.oracle.com

Hi everybody, How to do it in JAVA: I have a text file that is filled with new lines of text every n seconds. This text file get very massive. I want to have my program to monitor this text file and to be able to read only the new added line when it detect that a new line has been ...

68. Reading from file    forums.oracle.com

69. reading from a file in java    forums.oracle.com

70. Reading from a file    forums.oracle.com

You can use string tokenizer class and break the input into tokens, when you are using String tokenizer class it stores the tokens(every word) in an array automatically so then from here its simple. use a for loop and search for the full stop, when you find it( from the start index till here, put these array values in a String ...

72. File Reading Question    forums.oracle.com

73. Reading multiple files    forums.oracle.com

I'm gonna guess no. The API doesn't seem to support switching out streams on the fly or whatever it is you're trying to do. So what is it you're trying to do? I've never tried what you want or seen anyone do it. My advice would be just to reconstruct the BufferedReader with the new Reader when/if you have a new ...

74. Read File with String and Floats tab delimited    forums.oracle.com

Hi Everyone, I am new to Java programming and I am having problems reading a file and then taking the file and breaking it strings and floats. Example of my text file: 1 SOLF 25.20 -2.42 28.50 28.90 25.07 27.62 1/11/2008 4:00:10pm 2 BYI 47.33 -1.70 48.56 49.00 47.24 49.03 1/11/2008 4:02:49pm I am trying to assign the colums as follows: ...

75. Reading Large Files - How?    forums.oracle.com

Generating a file with the name "John Smith" repeated 200,000 times and running your code (with appropriate definitions of source and word) with that file on my laptop prints out the value of the word variable 200,000 times and "... found 200000 products. " appears after 2.37 seconds on my mid-range laptop. Either a) you need a much faster computer b) ...

76. Problems with Reading Files    forums.oracle.com

77. Store a read only file with properties?    forums.oracle.com

The method setReadOnly() in the type File is not applicable for the arguments (boolean) Its just setReadOnly() Oke this is maybe a little stupid but here comes my new question: What I'm trying to do is saving some int's in a file. Users should not be able to edit it. But the application has to be able to edit the file ...

79. Reading an Html file    forums.oracle.com

Hi, i didnt under stood your requirement properly. i will tell normal usage of the html and jsp page. usually we created the jsp page by using the html pages. converting the html page to jsp page means.simply we have to replace the html tags with struts tag. here we have repalce the normal html buttons with struts submit buttons. Regards, ...

80. Regarding The File Reading..... Urgent....    forums.oracle.com

Hi Friend I Have a Problem that. I have to read file witch content more then 5 lack records. And each line in the file is one record. My task is that I have to filter the record. Means to say that I have to filter that record witch are duplicate and I have to keep only one record means unique ...

81. Reading from file    forums.oracle.com

82. Reading a file and ignoring certain instances...    forums.oracle.com

I need to read a text file, and I need to extract words from it, not including any punctuation marks. I know how to read the file, but not entirely sure on how to skip over if it's not a word. Should I just use a bunch of if-statements? That doesn't sound like very good logic to me. :/

83. Reading a file - Problem with charset :(    forums.oracle.com

By using java.nio.charset.Charset charSet = java.nio.charset.Charset.defaultCharset(); the problem of identifying the charset is elliminated because when you call defaultCharset(), the default character set the JVM uses is used. Typically depends upon the locale and charset of the underlying OS is considered irrespecive of whether it is utf-8 or something else. -- Choicest Regards Amit Singh Rathore

84. Reading a file with structures    forums.oracle.com

Its not the actual implementing of the variables im concerned with, i have a system somewhat worked out already, but serialization does seem like a better idea. The problem is I really have no clue on how I would actually read the file, and use those structures to get the data. After I read the file, and do each line, how ...

85. Reading Song info of a song file    forums.oracle.com

What can I use in Java to get the information of a song? Like say I had a file named song.mp3, and it was a 50 cent named Wangsta, Producer Dr. Dre, etc. Itunes stores all that data in the mp3, so what can I use in Java to read that data?

86. Reading files from the internet    forums.oracle.com

I am currently working on a program that must read an input file from the internet using a Scanner object. I know that to read files in from the computer, one would use "Scanner scan = new Scanner (new File ("myfile.txt"))" and that to read keyboard input "Scanner scan = new Scanner (System.in)". If I were to have a specific web ...

87. Reading mulitple files    forums.oracle.com

88. help reading a file Pleasee!!    forums.oracle.com

I'd suggest creating a class that can read the whole file in and store it in an appropriate data structure or class (e.g., create a class called Account, and have this class create a List of Account objects). Then make that class be able to take that data structure and write it to a file, in the same format that it ...

89. Read bz2 files?    forums.oracle.com

90. Reading Files (simple question)    forums.oracle.com

Is there any other way to read through a file other than nextLine? I know there's probably a simpler answer, but the only way I could think of doing it is storing the next line as a String and trying to find the specified word in the string. Not only am I not sure how to do that, I imagine there's ...

92. reading objects from a file    forums.oracle.com

Hello, I searched about reading objects from a file in this forum but I didn't find some good answer to my problem. In my case I have a producer of objects that is putting the objects temporary into a buffer and if the buffer is full, I'm calling a procedure that writes in file the buffer content and so on until ...

93. Facing problem in Reading a tab-delimited file!!!    forums.oracle.com

I could extract the values from only one row of tab-delimited file, as the tab-delimited file had the values also in row wise. then i tried filtering , BufferedReader fileRead = new BufferedReader(new FileReader("vvv.txt")); String str; String tempBuf; // while ((tempBuf=fileRead.readLine())!=null){ // Reading file till the EOF str = tempBuf.replace('\n', '\t'); // Replacing the '\n' by '\t' (filtering) fields = tempBuf.split("\t"); ...

95. file reading problem: peculiar one    forums.oracle.com

96. reading from a file    forums.oracle.com

97. reading file    forums.oracle.com

98. Problem - SVG File Reading from memory - Batik    forums.oracle.com

Hi, I am using Batik Library to render SVG File to my Application panel. This can be easily done by using setURI(string URL) method of JSVGCanvas. But the problem is I can't find any functionality that loads the SVG Image from Byte Stream in the memory. If I have the SVG file in my memory then I have to dump it ...

99. NullPointer while reading the File by java.io.LineNumberReader    forums.oracle.com

Hi I use a org.apache.struts.upload.FormFile. I take the InputStream of the File. Then i use java.io.LineNumberReader of InputStream. Then i read the file line by line as lineNumberReader.readLine(). Then i check while(lineNumberReader.readLine()! = null )then i proceed. It is work well. But at the end of the file that is after all the records are readed I got the NullPointerException. After ...

100. reading autoCAD files in java    forums.oracle.com

Hi I am not quite sure in which thread this quiestion should be posted So I post it here I need to import Auto CAD files (DWG) into a java program for further processing with 3D api. I dont have any idea for doing it. Can any body give me a hint or link ? If there are guys who has ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.