write 1 « API « Java I/O Q&A





1. Easy way to write contents of a Java InputStream to an OuptutStream    stackoverflow.com

I was surprised to find today that I couldn't track down any simple way to write the contents of an input stream to an output stream in Java. Obviously, the byte ...

2. Testing what's written to a Java OutputStream    stackoverflow.com

I am about to write junit tests for a XML parsing Java class that outputs directly to an OutputStream. For example xmlWriter.writeString("foo"); would produce something like <aTag>foo</aTag> to be written to ...

3. Writing large strings with DataOutputStream    stackoverflow.com

I've been doing some socket programming to transmit information across the wire. I've run into a problem with DataOutputStream.writeUTF(). It seems to allow strings of up to 64k but ...

4. Is it ok to use same file writer for writing different files    stackoverflow.com

There's a loop where we get certain data. Depending on the data, file writer needs to write to different files. Is it a good practice?

5. RandomAccessFile.write not writing what I tell it to    stackoverflow.com

Hey all. I'm reading from one sql-format file to another, and two bytes in the middle are being corrupted, and I assume it's some preparation or safeguard that I didn't ...

6. Java - writeLong method of DataOutputStream and writing hex    stackoverflow.com

Currently, I have:

outByte.writeInt(0x49492a00); 
outByte.writeInt(0x08000000);
But i want to be able to write all of that on the same line. But:
outByte.writeLong(0x49492a0008000000)
is underlined red in Eclipse, and therefore incorrect. Is it possible to write ...

7. (java) Writing in file little endian    stackoverflow.com

I'm trying to write TIFF IFDs, and I'm looking for a simple way to do the following (this code obviously is wrong but it gets the idea across of what I ...

8. Why Java OutputStream.write() Takes Integer but Writes Bytes    stackoverflow.com

I am writing an OutputStream, just noticed this in the OutputStream interface,

   public abstract void write(int b) throws IOException;
This call write one byte to the stream but why it ...

9. Why is nothing being written to a file?    stackoverflow.com

I am creating and writing to a file using the following pattern:

File afile = new File("C:/dev/ws/DataOrdering/data/" + thisDate
    + "_" + thisTime + "_visdata.csv");
FileWriter writer = new FileWriter(afile);
writer.append(tradeDetails);
writer.close();
However ...





10. Write a binary downloaded file to disk in Java    stackoverflow.com

I have a software that allow to write add-on in javascript files (.js) that allow to use Java function (I don't know if this is common, I never saw java call ...

11. Java: BigInteger, howto write it thru an OutputStream    stackoverflow.com

I want to write a BigInteger to a file.
What is the best way to do this.
Of course I want to read (with the program, not by human) it from an inputstream.
Do ...

12. java : writing large files?    stackoverflow.com

Greetings , I get huge number of records from database and write into a file.I was wondering what the best way to write huge files. (1Gb - 10Gb). Currently I am using BufferedWriter

BufferedWriter ...

13. Why does RandomAccessFile use int as offset    stackoverflow.com

I am writing some data access test implementation and I need random access to file content. Here's the code:

RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rwd");
final byte b[] = IOUtils.toByteArray(source);
randomAccessFile.write(b, (int) offset, size);
where ...

14. Java BufferedWriter, OutputStreamWriter able to write to closed FileOutputStream    stackoverflow.com

I was expecting the following code to throw an exception when I goto write data to the Stream:

File file = new File("test.txt");
FileOutputStream fs = new FileOutputStream(file);
OutputStreamWriter ow = new OutputStreamWriter(fs);
BufferedWriter writer ...

15. Creating and writing file from a FileOutputStream in Java    stackoverflow.com

Okay, so I'm working on a project where I use a Java program to initiate a socket connection between two classes (a FileSender and FileReceiver). My basic idea was that ...

16. Java: Is my input.readObject() getting truncated on either write or read?    stackoverflow.com

I'm building a system to exchange encoded messages, call it bank and client. The first messages that I need to exchange are long Strings. They appear to be truncated ...





17. Files written with FileWriter are either 32 KB, 24 KB, 16 KB, ... big or empty    stackoverflow.com

I read a file into a string, change the first line and then write this string into a new file. I do this through the following code (a little bit shortened):

while(jspIterator.hasNext()){
 ...

18. Writing to an already existing file using FileWriter Java    stackoverflow.com

Is there anyway I can write to an already existing file using Filewriter For example when the user clicks a submit button:

FileWriter writer = new FileWriter("myfile.csv");
writer.append("LastName");
writer.append(',');
writer.append("FirstName");
writer.append('/n');

writer.append(LastNameTextField.getText());
writer.append(',');
writer.append(FirstNameTextField.getText());
I want to be able to write ...

19. Java FileOutputStream String Writing    stackoverflow.com

I’ve been having issues with a Java File. Its designed to write line after line in a test file as a log. Unfortunately it overwrites the same line every time I call ...

20. Shift the file while writing?    stackoverflow.com

Is it possible to shift the contents of a file while writing to it using FileWriter?
I need to write data constants to the head of the file and if I do ...

21. why is bufferedwriter not writing in the file?    stackoverflow.com

Here is the code snippet.

read = new FileReader("trainfiles/"+filenames[i]);
                br = new BufferedReader(read);
     ...

22. Is there a better way to write the full contents of a file to an OutputStream?    stackoverflow.com

When I want to write the full contents of a file into an OutputStream, I usually allocate a buffer as a byte[], then make a for loop to read data from ...

23. How to write "enter key pressed" to a stream?    stackoverflow.com

Sorry for this odd-sounding title... I have the following situation: I want my Java program to interact with an external console. In order to "send" the individual commands to that console, I ...

24. why only 1 java source file is able to write into the same file?    stackoverflow.com

In my StockTransaction.java, this runs first

try{
        FileOutputStream fos = new FileOutputStream("C:"+File.separatorChar+"transactions.dat"); 
        OutputStreamWriter osw = new OutputStreamWriter(fos); ...

25. Why is RandomAccessFile writeLong implemented with multiple write calls?    stackoverflow.com

While profiling an application I noticed that RandomAccessFile.writeLong was taking a lot of time. I checked the code for this method, and it involves eight calls of the native method write. ...

26. how to write content in a Specific position in a File    stackoverflow.com

Suppose I have a file named abhishek.txt and that contains the following line

I am , and what is your name.
Now I want to write
Abhishek
after "I ...

27. Java - how do I write a file to a specified directory    stackoverflow.com

I want to write a file results.txt to a specific directory on my machine (Z:\results to be precise). How do I go about specifying the directory to BufferedWriter/FileWriter? Currently, it writes the ...

28. How to append to the end of a file in java?    stackoverflow.com

...
Scanner scan = new Scanner(System.in);
System.out.println("Input : ");
String t = scan.next();

FileWriter kirjutamine = new FileWriter("...");
BufferedWriter out = new BufferedWriter(writing);
out.write(t)    
out.close();
...
if I write sometring into the file, then it goes ...

29. What is the difference between append and write methods of java.io.writer?    stackoverflow.com

The java.io.Writer interface has two methods called append and write. What are the differences between these two? It even says that

An invocation of this method of the ...

30. DataOutputStream writing too much    stackoverflow.com

What I currently have

I'm currently trying to create a little download manager in Java and I have a problem with writing the loaded bytes in a file. I'm using a DataOutputStream ...

31. Broken Pipe Java program writing in an external C programs stdin and reading from stdout    stackoverflow.com

I am using the follwing java code to write in the stdin of a C program which basically reads from stdin adds A_A_A to the end of the line and writes ...

32. Java - How to detect file deletion while writing to a file?    stackoverflow.com

Our java program writes some important data into a file continuously. Now we want to thrown some exception or display some kind of error message on the console whenever the file ...

33. Using FileChannel to write any InputStream?    stackoverflow.com

Can I write any InputStream into a FileChannel? I'm using java.nio.channels.FileChannel to open a file and lock it, then writing a InputStream to the output file. The InputStream may be opened by ...

34. bufferwriter not writing to file    stackoverflow.com

The bufferwriter is not writing to a file. Please can anyone tell me what could be the issue

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Writer;


public class main {
   ...

35. How to write content to a specific location in the file using FileWriter?    stackoverflow.com

I am using Java FileWriter to write a content into the existing file, but the content is added to the end of the file. I want to add the content ...

36. Write to file at particular index    stackoverflow.com

I need to write to a file at a particular index position. BufferedWriter and PrintWriter does not allow writing to an index. How do I go about achieving this? Basically what ...

37. Using JarEntry to write sound files is not working as intended    stackoverflow.com

public static void writeFile(String theFileName, String theFilePath)
{
    try {
        File currentFile = new File("plugins/mcMMO/Resources/"+theFilePath+theFileName);
        ...

38. How to speed up/optimize file write in my program    stackoverflow.com

Ok. I am supposed to write a program to take a 20 GB file as input with 1,000,000,000 records and create some kind of an index for faster access. I have ...

39. FileOutputStream.close is really slow when writing large file    stackoverflow.com

I have a method which receives a file over a TCP socket using this code:

FileOutputStream fileStream = new FileOutputStream(filename.getName());
while (totalRead < size) {
    if (size - totalRead > ...

40. How can I write 7 byte Integer value to DataOutputStream, which contains 15 digits?    stackoverflow.com

I have to write 7 byte Integer value to DataOutputStream, this Integer contains 15 digits. How can I do that?

41. File Write - PrintStream append    stackoverflow.com

I am trying to append some information into a text file, but it only writes the last element. There are many Engineers, but it prints to the file only the last element ...

42. Why does BufferedWriter write method produce different results?    stackoverflow.com

I don't understand why these two implementations produce different results? Method with expected results:

    private void writeToFile(WorkoutLog log){
        try {
   ...

43. Java BufferedWriter Write method    stackoverflow.com

I am creating a CSV file using BufferedWriter from a ResultSet object. A few of the database columns hold null values. When I call obj.write(rs.get()) I am getting ...

45. Write to random access file using superclass and extended class methods    stackoverflow.com

I have a Book class and a Library Book class which extends Book. I am storing the information in a random access file. I have a writeToFile method which writes Book ...

46. Write to BufferedReader from another class    stackoverflow.com

I need a method to write to a BufferedReader input from another class. In class A I use BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); and str = stdin.readLine(); to get input from ...

47. writing user input to a random access file    coderanch.com

Hello, I am trying to take user input (customer info such as name, address, phone number , etc. from many text fields - use enter to go to next text field as they are set up in a grid layout). This is done in one class and when you click the "Save" button in the frame I want to write this ...

50. reading from inputstreams and writing ....    coderanch.com

how to write -- what we have read from an inputstream ? eg there are classes like url, urlconnection etc which give you an inputstream. i need to be able to write that information that is being read from the InputStream. I am able to write to the standard output ok, but i want to write into a file instead. where ...

51. passing hex to FileOutputStream write methods    coderanch.com

This code creates a file and writes two values to it. The values, however, are different: first: 0xaabbccdd (-143053899 as an int) second: 0xdd (221 as an int) However, when written to the file using write(somehex), the output to the file is IDENTICAL in value! How is this possible? (incidentally, this is based on a practice question for the programmers certification ...

52. Problem writing to FileInputStream    coderanch.com

54. Have a stream write to a variable    coderanch.com

55. writing to random access file    coderanch.com

I've found a way to write a string to a random access file at a certain point in the file, but it overwrites the text that was there before. Is there a way to 'insert' new text in the middle of a file and move all the stuff that was there before to a position after the newly written string? Thanks ...

56. write and append with same streams.    coderanch.com

Hello, I am using this piece of code to create a new file and write something to it. java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter(filename,false)); out.write(_header); out.write(_package); out.close(); After this, if i want to open the same file and append the same things to the end of this file then what stream shuld i use. BufferedWriter does not have a seek function ...

57. Writing and Reading JPEGS from stream    coderanch.com

My java program is an interface to a C program which it calls with Runtime.Exec(). So I have the C program as process p. I wrap p.inputstream() with an ImageInputStream. The C program outputs some text data, then outputs the length of the upcoming jpeg and then outputs the jpeg as binary, outputs more text data, another jpeg, text, jpeg, etc. ...

58. FileChannel: 2 gig limit for read but not write    coderanch.com

Hi there! I am attempting to use a FileChannel to read the contents of a file that is 18.6416 gigs of doubles. The specific error is an IllegalArgumentException generated at this line: fc_level2.position(j); where j is a integer set in a for statement (it is never negative) which means that position was being set to a number larger then MAX_VALUE = ...

59. PrintWriter() not writing to disk unless file is very large    coderanch.com

My PrintWriter will write (some) data to disk if the file written is very large but none if it is small. The StringBuffer writes to screen ok with a small file, but won't write all of a large file, unless PrintWriter is commented out. (Small test file 355b, large 839k). package java146.project1; import java.io.*; import java.util.*; import java146.util.*; public class TokenCount ...

60. outputstream.write(byte[]) issues    coderanch.com

I'm having a problem writing to my serial port some of the time. It works like a charm many times and then seems to just freeze up completely. It doesn't throw any exceptions, but the code seems to block on that line indefinitely. I've tried many things to get around this: closed and re-opened the outputstream, checked for other serial port ...

61. How to calc bytes written into OutputStream    coderanch.com

Hi, I have a method which writes data into OutputStream. While I do not want to modify method, I need to get the size of data (in bytes) written. OutputStream is given to me by another class and I am not aware of exact implementation given. So situation is: I get OutputStream and pass it to method mentioned above, but I ...

62. Searching a large file written by ObjectOutputStream    coderanch.com

Hi Folks, I have a problem with large files and I was wondering if anyone here could give some suggestions for a solution. I have a very large file that contains possibly several thousand objects. They are serialized using ObjectOutputStream. The file could be as much as 1GB or greater! Each object is also quite large, possibly 5000KB per object. If ...

63. difference between PrintWriter.println and PrintWriter.write    coderanch.com

Hello Please see the below code:- out.write(request.getParameter("name")); I got the java.lang.NullPointerException when there is no "name" parameter passed to url. Tell me why below two sample codes gives the same output for url . http://localhost:8080/myapps/FirstServlet?name=kamani&name=bhavin&name=kashyap Output: nilesh bhavin kashayp 1) String value[] = request.getParameterValues("name"); for(int i=0; i

64. Writing an int[][] via ObjectOutputStream    coderanch.com

After about a year of absense, I return to you gentlemen, again at my wits' end. The setup: Server tells client the initial state of the board (int[][]) Client updates board to match while( true ){ ..Via mouse input, coordinates of a move are sent to server. ..Server updates board ..sends client the new board ..client updates board to match } ...

65. Lock RandomAccessFile for writing    coderanch.com

I want to write to a file and while its being written I do not want it to be read. After the file has been fully written and closed , it should be available for reading. How may I do this ? If I use the FileLock facility with the RandomAccessFile, then that does not seem to work. I am able ...

66. Write a String to ByteArrayOutputStream    coderanch.com

Hi, I know how to read data from a ServletInputStream (or a FileInputStream) and write it to ByteArrayOutputStream. Example: ServletInputStream sis = request.getInputStream(); // or InputStream sis = new FileInputStream("ABC.txt"); byte[] buffer = new byte[4000]; ByteArrayOutputStream baos = new ByteArrayOutputStream(4000); int bytesread = 0; while(true) { bytesread = sis.read(buffer); if (bytesread == -1) break; baos.write(buffer,0,bytesread); } However, I would like to ...

67. Writing input stream to file    coderanch.com

I would like to know whether it's possible to write the contents of a ServletInputStream to a file. My JSP page POST's an image, and I want my servlet to write that image to file. How can I do this? I know how to get the InputStream from the Servlet, but I'm not sure of the code to use the incoming ...

68. PrintWriter.write(int c) Question    coderanch.com

Hi Friends, I am trying to follow a tutorial. They present there code #1: import java.io.*; class CopyInput { public static void main(String[] args) throws IOException { int b; while ((b = System.in.read()) != -1) System.out.write(b); } } And then they say that if you execute C:> java CopyFile outfile then you can copy a file. Well, I don't see ...

69. writing file to OutputStream    coderanch.com

Well you can't write (the contents of) a file to an OutputStream if that file does not exist, now can you? Of course it is possible to copy the contents of any InputStream to any OutputStream without saving the results to a file first: InputStream is; OutputStream os; // initialize byte[] buffer = new byte[4096]; // tweaking this number may increase ...

70. Unable to write to a file using PrintWriter    coderanch.com

Hi , I am using the following code to create a file and write to it - ________________________________________________________________________ String md5sum = "my name is abhinav"; PrintWriter pw = new PrintWriter(new FileWriter("TestFileAbhinav")); pw.println(md5sum); _________________________________________________________________________ The file is getting created but the string is not getting written to the file.Where am I going wrong?Please help.

72. Writing a String to a File using FileChannel    coderanch.com

hi When I started exploring the NIO apis , i found that using FileChannel to write to a file using ByteBuffer is slower compared to normal IO write using BufferedWriter . I even mixed both IO and NIO to write to a file still its slower than using IO BufferedWriter using FileWriter . //using NIO and IO String str = "javaranch"; ...

73. DataOutputStream.write( bytes[], int, int )    coderanch.com

I am trying to build a server that allows file transfering but I am still having problems to send bytes into the output stream ( clientSocket.getoutputStream() ), using DataOutputStream.write( bytes[], int, int ). I've read the specification but i found it was not very clear. I've saw an example it used a loop while to send the bytes, but i did ...

76. PrintWriter can only write 130k?    coderanch.com

You are not flushing or closing the output stream when you're done. Because of that, some of the data may have not been written to the output file when the program ends. Make sure you call out.flush() and out.close() at the end of the program. Also close the input stream by calling in.close().

77. PrintWriter does not write. Why?    coderanch.com

The following code writes 0 bytes to the destination file (the file gets created but has 0 byte). But the source file is reading quite well and prints on the screen. Can anybody please tell me where am I going wrong? // Program to copy a Text file import java.io.* ; public class TextFileWrite { public static void main(String args[]) { ...

78. writing froma stream to a File    coderanch.com

I'm Trying to write to a file. what exactly do i need to correct here. Right now it just keeps creating an empty file. Why's that? public void download(String address, String localFileName) { OutputStream out = null; URLConnection conn = null; InputStream in = null; try { URL url = new URL(address); out = new BufferedOutputStream( new FileOutputStream("C:\\"+localFileName+ ".txt")); conn = ...

79. Writing with printstream    coderanch.com

I am using PrintStream class(print()) whenever I want to execute a command on the ftp connected server through java. The print function is taking input as string and that string's characters are converted into bytes according to the platform's default character encoding. With reference to the above whenever I want to execute a command , the first word of the command ...

80. I/o and streams: appending a source file and write to two new files.    coderanch.com

Could you guys Help me by telling me if you know where i can get an example so I can see how to write the code to get my work done. I don't want my work done for me. I just need examples that are in the ballpark. Develop an application that reads product id, product name and product price from ...

81. Writing a FileOutputStream into a File    coderanch.com

I'm working on a calendaring system using ical4j to create the ical addresses but I'm trying to write the stream to a file to attach them via the attachFile() method. I've got the files being created correctly but cannot get the FileOutputStream to write the data into the file itself: MimeMultipart multi = new MimeMultipart(); MimeBodyPart calBody = new MimeBodyPart(); CalendarOutputter ...

82. Problem with writing and reading using RandomAccessFile    coderanch.com

Hello, I am using RandomAccessFile to write and read data to/from a Binary File. Writing: RandomAccessFile out = new RandomAccessFile(binFile, "rw"); for (int i=0; i

83. Reading and Writing using a Large Random Access File    coderanch.com

I have a delimited file where each line is of a varying length and can have a varying amount of delimiters. I need to access a random line and replace it with a new line that may be shorter or longer in length. Because the file is large (20MB+), I need to do this as efficiently as possible. I started with ...

84. Writing a file reader    coderanch.com

I am currently working on a problem in which I have a file created by a proprietary codec. I know the file format specs. I have to write a file decoder such that it can send its output to a buffer. Then an executable program will take the buffer output to display an image (the file is an image file). I ...

85. write a file in java (but not with FileWriter)    coderanch.com

Hi, I'd like to have my java program (Java 1.5) write to a text file but I don't want to use the java.io.FileWriter class (as my rational analyser indicates that I should avoid doing this, but it doesn't say why I shouldn't nor does it suggest an alternatives) Currently I have as below: FileWriter output = new FileWriter("myFile.txt", false); output.write("some info ...

86. RandomAccessFile write() problem    coderanch.com

Hi all, i am using RandomAccessFile write(bytes b[]) method. When tried to write multiple lines with multiple write() for the first time it is writing well to a file. But if i run the same program for the second time first write() method is skpping and all other write() are writing text to the file. Can any one let me know ...

87. filechannel.write is taking long time    coderanch.com

please see below program. This program takes around 35 milliseconds on 8 core machine when count is 100 or more. But when I comment below line channel.truncate(0); then it takes around 2 milliseconds. I ran this program on different linux machine where OS, JDK is same. I found that it is working fine on some machine and its worst on some ...

88. RandomAccessFile write bytes    coderanch.com

Hello, I would like to write a String as a byte array and read it again. Now i have the problem when i wan't read the byte array again and convert it to a string i don't get the same string. Any suggestion where the fault is? RandomAccessFile raf = new RandomAccessFile(File, "rw"); try { String localHostName = "host"; raf.write(localHostName.getBytes()); byte[] ...

89. writing a file onto an outputStream    coderanch.com

Thanks, managed to work out that reading it would be the best thing to do. What I didn't know was that I needed to read the file as bytes. Eventually got it though. I did: //inputstream to read the file to send FileInputStream inputStream = new FileInputStream(theFile); //scan the file until all bytes are written on the output stream boolean finished ...

90. reading a file written to OutputStream    coderanch.com

Hello, I have a method that I need to call that would return a pdf image. But instead of anything being returned from the method, the method writes to a outputstream that is passed as a parameter. The method signature: public void getPDFFile(inputParams, OutputStream stream) My problem is I am again a intermediate application where I need to read the stream ...

91. Difference in writing bytes to OutputStream    coderanch.com

Hey, I am currently trying to access Plugwise energy meters. I have working C# code, which I want to convert to Java code. The C# code just opens a serial port and writes a bytes-encoded command to the outputStream: protected byte[] commandOff = new byte[] { 5, 5, 3, 3, 48, 48, 49, 55, 48, 48, 48, 68, 54, 70, 48, ...

92. Skipping input and writing to file using FileWriter    coderanch.com

I have a question. This is my first commercial application and I'm having some issues printing four 96 well plates to a text file because I have to point the input stream to the top of the page and ignore the first 41st characters on the same line in order to print plate C. What I'm trying to do will be ...

93. About PrintWriter with println and write    coderanch.com

Hello friends, I'm studying the Java I/O but I have a little bit of confusing, can you help me? I will do examples only with the character stream, because (I think) the byte stream is the same. I have studied the I/O hierarchy and I know I can chain two or more classes to improve the funcionality, but I don't understand ...

95. Writing with RandomAccessFile    forums.oracle.com

Hi, Using RAF will not directly do what you want as it does not support random insert. Some options are... 1) Read each line from the file and write the output to a new file. When completed rename the new file to the original name. 2) Read each line from the file and save all lines to the StringBuffer. Then seek ...

96. URGENT HELP REQUIRED PLEASE: DataOutputStream & Write to File    forums.oracle.com

URGENT HELP REQUIRED PLEASE: DataOutputStream & Write to File Posted: Jul 23, 2008 11:19 AM Reply Hi I am quite new to Java. I have to create a simple CRUD (Create, Update, Find, Delete) application that will also allow data to be saved. I have wriiten and compiled a program, and it works, but have not yet added the ...

97. How to read & write with DataInputStream & DataOutputStream?    forums.oracle.com

I don't see why you even need DataInputStream and DataOutputStream. What functionality do they provide that the FileInputStream and FileOutputStream don't? Oh, OK. I have no idea what I should be using. The last, and only programming course I have ever taken was fortran about 20 years ago. I am doing a course on Networking right now by distance learning that ...

98. How to write or Read Arabic Charactars with Stream    forums.oracle.com

No matter which language, you basically have to find out which encoding your files are in and specify that when reading them using a InputStreamReader. I can't tell you what encodings there are specialized in arabic characters, but there are a few general-purpose encodings that you might try: UTF-8 and UTF-16 are possible candidates, as they can represent every Unicode character. ...

99. can't write to a file with FileWriter class    forums.oracle.com

First off, don't use finalize(). It is never guaranteed to actually run. Just add a cleanup() method to your Account class that flushes and closes the writer; and call it before you exit main(). Now, as for your Date problem java.util.Date certainly does have a no-args constructor. java.sql.Date does not. Make sure you aren't getting a name collision. (Hint: If you're ...

100. Help - Writing my own input stream class    forums.oracle.com

Hi, I have read through this link but I am still confused as to how to solve my problem. (http://java.sun.com/developer/technicalArticles/Streams/WritingIOSC/) Basically I have to write a class that extends the class InputStream, and so write my own implementation of the read() method. What I do not understand fully is exactly how to do this. The class is needed so I can ...