data « File Attribute « Java I/O Q&A





1. Java data object for bidirectional I/O    stackoverflow.com

I am developing an interface that takes as input an encrypted byte stream -- probably a very large one -- that generates output of more or less the same format. The input ...

2. Overwriting existing data in external file, how do i stop this?    stackoverflow.com

When new data is entered in the GUI and exported to the following file it replaces the existing data, how would i prevent this and make it add to the existing ...

3. Simple, structurally typed XML data binding (without code generation or reflection)    stackoverflow.com

I'm looking for a Java library that would allow me to marshal XML to a Java object tree, and vice versa. There are plenty of libraries that would allow me to ...

4. Problem with UTF-8 String and binary data    stackoverflow.com

prehistory: http://stackoverflow.com/questions/3262013/java-regular-expression-for-binary-string I can extract a substring with binary data I need, but when I use

   String s = matcher.group(1);
It seems that data is spoiled,
to be exact spoiled ...

5. What is the fastest way to generate lots of XML data?    stackoverflow.com

I'm working on a Java utility that generates a bunch of XML documents matching a specific DTD using slightly randomized layout generation (so, for example, the document might look like <a><b><c ...

6. Easiest point-multipoint data distribution library/framework in Java    stackoverflow.com

I have a table in a central database that gets constantly appended to. I want to batch these appends every couple of minutes and have them sent to a bunch of ...

7. Creating an uneditable data file in Java    stackoverflow.com

I am currently writing a program which takes user input and creates rows of a comma delimited .csv file. I am in need of a way to save this data in ...

8. file based data provider    stackoverflow.com

here is my scenario. In my Junit tests, in many places, I need to provide user name, description, url, invalid url etc. So I hard coded those values. It is not ...

9. getting data from docx file table cells in java using docx4j    stackoverflow.com

in my program i have recursive method calls.where should i write the concatenating logic in my program

static void walkList1(List children,String str) {
  i=children.size();
  String temp=str;
  int i=1;
  ...





10. Create file name using data and time    stackoverflow.com

I hope you could help me, I'm trying to call in the date from another class and looks like "2011-03-09 06-57-40", I want to use this to create the file below ...

11. Java, Create file name using data and time    stackoverflow.com

I'm trying to create a file name that uses the date and time from another class to name it, problem is the class is called every so often and when it ...

12. How to calculate the file size downloaded and the total data to be downloaded in Java?    stackoverflow.com

How to calculate the amount of data downloaded and the total data to be downloaded in Java? E.G. 12kb/130kb...110kb/130kb

13. How to retrieve/read existing OCR data in .tif files using Java?    stackoverflow.com

I want to get existing OCR data in .tif files using Java. This OCR data is created using MS Office Document Image Writer. I have searched a little bit open ...

14. java - how to get data of a file from a form?    stackoverflow.com

I've created a form and I need the user to enter some info then upload a picture.
So lets say I have something like this:

<form method="post" enctype="multipart/form-data" action="some servlet/filter">
<input type="file" name="logo">
</form>
I ...

15. Control amount of data retrieved - java.io    bytes.com

brendanmcdonagh Hi all, I've come up with an idea but I'm struggling with the implementation! My network thread contacts my server and presents some variables for a search of a web ...

16. Tokenized Data    coderanch.com

A ".txt" file needs to be read line-by-line where,each line contains data seperated by a token(,).The data on reading needs to be stored in a Collection class.The Data could be something like this - BILL_NO,N,5, 0, "Bill No.",abc RCPT_NO,N,5, 0, "Receipt No.",xyz Should the data columns be stored in "seperate" Collection instances ??? Which Collection class would be most appropriate ??? ...





17. Is it possible to truncate some data from end of file?    coderanch.com

Samir you can take advantage of the skip method of InputStreamReader class to skip reading the specified number of bytes at any place in a file or any other sink. Here is a sample program in which i will skip reading bytes in the middle of the file. Would u tell me the what program u are developing & y u ...

18. Prepending data to a file    coderanch.com

Hi, I want to know if there is any way in Java where I can prepend data to a file. Currently yhis is what I have been doing- ex) Let the file to be written to be Log_file 1.I rename the file to Log_file_temp. 2.Write the data I have in a buffer to the file Log_file. 3.Once this is over, I ...

19. Meta Stock data ?? Anyone?    coderanch.com

Here is the situation. Our company provides financial applications to various end users, businesses, etc. We are looking at purchasing historical data from another company. The program that they offer for downloading the data is written in C++. So...the files downloaded are in MetaStock format (*.dat). The program offers a manual way of converting to .txt but I would like to ...

20. Meta Stock data ?? Anyone?    coderanch.com

Here is the situation. Our company provides financial applications to various end users, businesses, etc. We are looking at purchasing historical data from another company. The program that they offer for downloading the data is written in C++. So...the files downloaded are in MetaStock format (*.dat). The program offers a manual way of converting to .txt but I would like to ...

21. GZIPOutputStream - size of compressed data    coderanch.com

Hello, I compress data using GZIPOutputStream. Is there any way to find out the size of the compressed data? here is what I do sb ( StringBuffer )has some data... GZIPOutputStream gzos = new GZIPOutputStream(response.getOutputStream()); gzos.write(sb.toString().getBytes()); gzos.close(); Kindly let me know.. I need to find out how good the compression is.. Ram

22. serizalize primitive data type    coderanch.com

23. question on primitive data types    coderanch.com

class Maroon { public static void main (String[] args) { int a = 1; // 1 short b = 1; // 2 long c = 1; // 3 a = c + a; // 4 c = b + a; // 5 }} A compile-time error is generated at which line? a. 1 b. 2 c. 3 d. 4 e. 5 ...

24. Getting data from FileUpload tempFile    coderanch.com

Hey fellas and felines, I got a question: If upload a file via form to an application server, I can access the temporary file through request.getParameter("file") and the old filename by request.getParameter("file.filename"). BUT does every JavaAppServer understand this ".filename" or ".content-type"? is there a Java-only method to acquire the old filename and content-type from that tempfile? Any pointers welcome...and if somebody ...

25. Code for pulling out specific data from file    coderanch.com

I'm new at Java. I'm trying to find an example of extracting data from a file that has similar characters such as 'abc001' or 'abc00467' or 'abc9999999987' and writing to another file. I want to pull out all the 'abc' entries. The challenge is as you can see part of the data is the same but with variable length. However there ...

26. how to insert data into existing file    coderanch.com

Hi, welcome to the ranch!! Often the simplest thing to do is read the whole file, pass most of it through unchanged, change the bits you have to change and write a new file. It sounds like that's what you're doing. I often mention this old trick from IBM's VM/CMS: read original write temp rename original to backup rename temp to ...

27. How to get the file data in chunks    coderanch.com

28. How to get the file data in chunks    coderanch.com

29. Export data to Excel    coderanch.com

30. Accent Character in File Name(not data inside it)    coderanch.com

Im facing a typical problem where the name of file contains an accent char. Ex, file name in current dir r.bat. Now if I create a File object giving this name, Java cannot read it as r.bat, and File.exists() gives false. However, if I get a list of files in current directory, it replaces the accent character to some different one, ...

31. How to POST data to a form    coderanch.com

I hope this is the right place, it is basically about use of URL and OutputStreamWriter but is has aspects of other things. I have a test web page that has 1 button, and will change the value of a text label when the button is pressed. It is developed with Java Studio Creator. This works when I use a browser. ...

32. Encode Data    coderanch.com

I want to encode the US-ASCII data into UTF-8. For that what is the procedure. I have to use 1.InputStreamReader and OutPutStreamReader 2.Charset/CharsetEncoder/CharsetDecoder What is the difference between the two processes? Process 1: FileInputStream fis = new FileInputStream(inputFile); InputStreamReader isr = new InputStreamReader(fis,"UTF-8"); FileOutputStream fos = new FileOutputStream(outputFile); OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); Process 2: Charset charset = Charset.forName(encode); CharsetDecoder ...

33. What IO classes can accept non-Java data types    coderanch.com

I am writing a server program and I need to allow access to clients that might be written in another language. I looked around the API and nothing stood out. Specifically, I need to be able to pass integral values and character arrays(in lieu of a Java String, since I doubt a Java String would accept a String from say a ...

34. Serial Data with Serial Cable    coderanch.com

I'm trying to pass data I received from a TCP socket connection to a serial port. I also have another application, running locally on the same machine, that is listening for data from that same serial port. I need some help in developing the code to send this data to a serial port (real or virtual) and have that application (that's ...

35. RS232 - Receiving Data    coderanch.com

I'm trying to receive data from device which is sending data. Instead of getting: 132 133 133 135 ... I'm getting: 13133 132 33 1133 133 132 133 132 13132 2 .... I tried to solve the problem. Im convinced thats format (byte to int,....) Problem. But I'm still confused. By the way: Hyperterminal did it without any problems. The interesting ...

36. Is there a way to recognize if the data is compressed or not?    coderanch.com

easiest but not the correct way. shouldn't catch exceptions to terminate a condition. I have both formats of data- zipped and unzipped that need to be processed(in the unzipping scenario).I can catch the exception while unzipping and assume that data is not compressed and do the normal processing but this is not the correct way. I should first gauge that the ...

37. export a data file    coderanch.com

39. Data reading/output from file    coderanch.com

You only use the tokens that are numbers and ignore the thrown exceptions for the rest of the tokens. It might be better to check first if the token is a number or not, something like this: while (line != null) { StringTokenizer st = new StringTokenizer(line); sum = 0; while (st.hasMoreTokens()) { try { String token = st.nextToken(); if(Character.isDigit(token.charAt(0))) { ...

40. modifying file data    coderanch.com

Text file contains following data artist1 title1 1 artist2 title2 2 artist3 title3 0 artist4 title4 -1 I want to modify it as artist1 title1 1 artist2 title2 2 artist3 title3 0 by deleting the strings of artist4 title4 -1 This is my code FileWriter fr = new FileWriter(sourcName); BufferedWriter br = new BufferedWriter(fr); String s1 = song.getArtist(); String s2 = ...

42. Enetring data in file help!    coderanch.com

Hi all. I have written a program to enter that ask filename and the data to enter. So my output will be like this Enter file name and data. file1 what is your name, file2 my name is alexander Till here its fine i am able to do what i need. I have used the split method to split the both ...

43. Problem : Writting Data Into File Using Channel    coderanch.com

Hi, I am using the following code for writting data in to file -- import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.FileNotFoundException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class MainClass { public static void main(String[] args) { String phrase = new String("test\n"); File aFile = new File("test.txt"); FileOutputStream outputFile = null; try { outputFile = new FileOutputStream(aFile, true); System.out.println("File stream created successfully."); ...

44. Help with Binary Data Creation    coderanch.com

Hello, I am trying to create a binary data like this: The data: 1, 2, 3, 4, 5, 6, 7, 8, 9 It should be represented as one record in a binary file, this record should be 8 bytes long (64 bits). What makes it difficult is that each digit in that data should be represented as 5-bit. Example, 1 should ...

45. Files with data range    coderanch.com

I have a .txt file containing data in the form of startrange,endrange,id Now, this file has huge data like 1 million records. I want that if someone gives me a number, i can lookup in this file to check if it falls in the range of startrange and endrange and return them the id. Now this can happen very often, so ...

46. How to get a clob file from data base and pass one instance of that file to another java method....    coderanch.com

Here is my sample code. public File getFile(----) { File file=null; try { Class.forName(driver); Connection conn = DriverManager.getConnection(url, username, pass); System.out.println("Connected to EBS"); //String sql = "SELECT * FROM ebswo where woid='"+origURL+"'"; String sql = "SELECT * FROM ebswo where woid='wso002'"; Statement stmt = conn.prepareStatement(sql); ResultSet rs = stmt.executeQuery(sql); System.out.println(); while (rs.next()) { docName = rs.getString(2); System.out.println("Document Name in buildDocInfo>>>>>" + ...

48. taking data from recent output file    java-forums.org

hello I have called whlole c code from java and then as result of calling c code from java the output file is saved. I need to call c code several times from java and then I need to use the data from the output file to do some calculations. but my problem is how to make sure that the data ...

49. file io operation to desire form of data dynamically    java-forums.org

task: attributes=6,files=3. name class group sub1 sub2 sub3 phani mca computers 87 89 98 malli mba finance 67 76 89 wilson hr company 89 90 98 OUTPUT: file1 file2 file3 ----------------------------------------------------- attributes ------------------------------------------------------ name phani malli wilson class mca mba hr group computrs finance company sub1 87 67 89 sub2 89 76 90 sub3 98 89 98 pls help in coding ...

50. Insert data in already exisisting exel file using jxl    java-forums.org

Hi all, I want to insert in a already excel sheet i have been able to find codes for creating new workbook and then writing data to it even reading is easy but i could not find the code to insert data in a existing excel.Please post your thoughts and solutions Thanks

51. Help With Outputting Data To A File    java-forums.org

Hi, I'm new here and am vaguely familiar to java but can't seem to get any combination of code to output the data I want to a file. Obviously the following is mostly taken from a tutorial. I want to output data under the "log" section to a new or already specified file (it doesn't matter to me.) It's marked by ...

52. Generating graph from data in File    forums.oracle.com

53. Averages using file data    forums.oracle.com

Hi all I've recently been given a task involving an interface and data stored in a file, the interface has a range of buttons on it including one to output the average price of all the items stored in the file. Now usually I'd find this easy but I just can't get the darned thing to work when streaming from a ...

54. Data File Creation    forums.oracle.com

Well, it's at line 35 of your code where you call the Integer.valueOf() method. That much you could probably tell from the stack trace, right? The other useful piece of information is at the top, where it says "null". That means you're passing a null value to that method. Find out why.

55. Data files    forums.oracle.com

I am very new to java programming, but old to general programming - I want to write a program for use by a company. I need customer files, order files, inventory files... I want the files to have fields (ex - cust #, name, address, terms, history of total ordered in year...). How am i creating these files (data base?). What ...

56. Embedded or internal data files    forums.oracle.com

I'm relatively new to Java and am trying to write a program for a small business and I do not want the file it reads data from to be accessible by the user. Here's what I don't want to do: have my java program just read from a text file located in the same directory. Simply hiding the text file is ...

57. Compress Data in filename    forums.oracle.com

I want to compress my data on file name. Example Class A has x,y integer and z String value Such as x = 111, y = 222 and z = 'Harddisk 3.5"' but filename can't format like this 111_222_Harddisk 3.5".xyz My questions are 1.How to make valid file name? 2.How to compress data to valid file name format? Do anyone have ...

58. wrting data to a file in specific positions    forums.oracle.com

Hi, i have written a program that reads from one text file, grabs certain data and I will write that data out to a new fie. I am successfully doing the write, but how do I tell it to write the different data in specific positions in that new file. Right now it just writes the data int he order that ...

59. What is the fastest way to pull a data record from a file?    forums.oracle.com

What is the fastest way to pull a data record from a file? Assuming you know the exact record size in Bytes and you a pulling by a primary key. Also assuming you are doing hundreds of searches each minute. A) RandomAccessFile: Have it seek through file by the record size and check the primary key of each record until found? ...

60. Copyig Data from a TABLE MODEL (TABLE) TO A FILE    forums.oracle.com

Im not 100% sure how to get the information from the model into the arrylist, though a loop. If there is a section of a webpage that may help could someone please post it for me. Unfortunatly for me Im visualy impaired and find some of this hard. I learn though looking at examples and creating my own programs that do ...

61. Create the object - not correct data in the file ?    forums.oracle.com

I have the text file, then I parse and create objects MyDocument (one row = one document). If row is corect then I create object MyDocument. But what I must do when row is not correct. The row can have 3 type of errors: 1.Not correct length of row 2.Not filled required fields in row 3.Field are filled by not correct ...

63. Anyone know where to place data files in Vista??    forums.oracle.com

My application has several folders under the working directory such as database, webserver etc. Where database and webserver stuff is stored. I use an installer to copy the required files to the program files directory. In XP my application can has full file permissions and can create and save files etc. However in Vista it would seem applications do not have ...

64. Why can't the files be outputed with their data.    forums.oracle.com

when doing the following: try{ readMyFile27(fileNameStr1); } catch (Exception e) { System.out.println("error: " + e); e.printStackTrace(); } .. ... public void readMyFile27(String file)throws Exception ... ... ... ... while ((len = in.read(buffer1)) > 190000) { when I add the above line and read the large file it will not output the data in the files just their respective file names and ...

65. On Vista ,in an .mdb file after un-installation too data persists how?    forums.oracle.com

Hi All, we use MS Access DB for our product developed using applet. when we install our product the access db (empty) will get loaded and the end user can start using the application. This works fine with XP. We installed our product under C: drive on Windows Vista ,after adding few users, un-installed the product.When we re-install the product the ...

66. English Dictionary data file    forums.oracle.com

67. Creating a file-oriented data system    forums.oracle.com

Hey everyone. I'm developing an application that will present stored animations on a fixed image, which is loaded on top of a jPanel. The image is actually depicting a guitar fretboard and what changes is the group of drawn dots and numbers that will illustrate how each chord is played. What I want to do is to store 268 different variations ...

68. How to get data from a file?    forums.oracle.com

Hello everyone, i'm new to this forum and to java too. Ok, so here is what i want to do: I want to get data from a file containing words and numbers and store them into variables that i will use them after to insert into a database table. For example i have a file called employees.txt in this form: eid ...

69. Identiying different types of data in a file    forums.oracle.com

I have a Tab seperated file with me. The file structure is:- The first row of the file contains the column headings. From the next line the file contains multiple rows of data which are seperated by tabs. for e.g. my file looks like this: a b c d e f g h 1 3 56 4 6.0 44 12 2 ...

70. Increazing the File size to hold more data in Java.IO    forums.oracle.com

public static void main(String[] args){ strCDREnvApp = args[0]; if(strCDREnvApp == null) System.exit(0); Runnable runnable = new CDREnvDetails(strCDREnvApp); Thread thread = new Thread(runnable); thread.start(); } } class CDREnvDetails implements Runnable{ private String strCDREnvAppl; public CDREnvDetails(String strCDREnvAppl) { this.strCDREnvAppl = strCDREnvAppl; } public void run(){ String strEnvName=null; BufferedReader br = null; StringTokenizer tokens = null; StringBuffer outf = null; FileWriter fl = null; ...

71. Inserting data inbetween the file    forums.oracle.com

Hi Experts, Is there a way by which i can read a file and insert some data in betweeen(eg: i need to insert a data or line in the file where the format is YYYY:) using the java file operations.. I guess FileWriter has a constuctor for appending the data at the end of the line but not inbetween them. I ...

72. hw can we plot a graph from the data given in a flat file    forums.oracle.com

i need a program that reads a file with 2 columns: - time in minutes for the x axis - value (e.g. temperature, heart freq.) for the y axis Plot the last m minutes, the y axis shall have a range from min...max. Start with parameter values m=5, speed s=1, min=20, max=120. After m=5 minutes, the graphical display shall plot the ...

73. passing data from a file between methods    forums.oracle.com

Presumably you mean that you need to display the un-encrypted content (all or part) to a user for modification before doing something with it. So 1. Unencrypt it into a String (or some other structure as appropriate.) 2. Display that to the user. 3. Collect the result from the user. 4. Pass the result to the final method.

74. Data file & JAva    forums.oracle.com

Generally, you would open Either a InputStream or a Reader for I/P, depending upon whether you are working with bytes or chars (also Strings), and either an OutputStream or Writer for the O/P ... same/same. Supply more details and ask specific questions after reading up, and we can help you further if you still need it. ~Bill

75. How to insert data in to file without Overwritting at any position in file    forums.oracle.com

I want to insert data into file at various postions (Begining,in between, at end) without overwriting existing contents. I am able to append contents at the end of file. One way is to create a new temp file but if we have to do so many insetions then it will create problems as we have to create so many temp files. ...

76. In the Begining it's Flat Files - Best Practice for Getting Flat File Data    forums.oracle.com

Our ERP is written in COBOL. We have a third party ODBC which allows us to access data using a version of SQL. I have several Java sources compiled in my database that access the data and return something relevant. The Java sources are written in a procedural style rather than taking advantage of object oriented programming with attributes and methods. ...