• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java IO-question

 
rax andy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea how to write main() method that reads in a buffer and writes it, using the read() and write() as explained below.
a)read:
read() reads in everything(including null) till it finds EOF.
b)write:
write() can write 1K at a time, and throws IOException.
At exception, it also gives information about the byte position at which exception occured.
This helps to recover from the exception.

Thanks in advance, Andy.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the Java Tutorial chapter on IO. It explains what you want to know and more.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!