iostream « API « Java I/O Q&A





1. Java - open existing file or create one if doesn't exist using IO streams    stackoverflow.com

I was following instructions from a Java website (http://java.sun.com/docs/books/tutorial/essential/io/file.html#createStream) on creating or writing a file using an IO stream. However, the code it provides seems to be broken in ...

2. byte stream and character stream    stackoverflow.com

Please explain byte stream and character stream files. What exactly these means , is microsoft word document is byte oriented or character oriented ? Thanks

3. In Java: why some Stream methods take int instead of byte or even char?    stackoverflow.com

Why some methods that write bytes/chars to streams takes int instead of byte/char?? Someone told me in case of int instead of char: because char in java is just 2 bytes length, which ...

5. coping streams - nio's channels vs. io    stackoverflow.com

Are NIO's Channels faster than IO's inputstreams/outputstreams when you want to copy one stream to another? if not when you would use channels?

6. How should I handle third-party input/output streams?    stackoverflow.com

There is a piece of project dealing mostly with input/output streams. So I have to pass streams as arguments and receive them from third-party libraries. I've read Good design: How ...

7. Why character streams?    stackoverflow.com

I understand that Java character streams wrap byte streams such that the underlying byte stream is interpreted as per the system default or an otherwise specifically defined character set. My systems default ...

8. Convert InputStream into FileInputStream    stackoverflow.com

I have read this post How to convert InputStream to FileInputStream on converting a InputStream into a FileInputStream. However, the answer does not work if you are using a resource ...

9. What is the proper way to write/read a file with different IO streams    stackoverflow.com

I have a file that contains bytes, chars, and an object, all of which need to be written then read. What would be the best way to utilize Java's different ...





10. how to end streamtokenizer loop when reading tokens?    stackoverflow.com

I know "while (((str.nextToken()!=str.TT_EOL)))" is an infinite loop, but I want to know how can I end this loop in a similar way that in StringTokenizer as "while (st.hasMoreTokens())", it ...

11. java: Do I need to close all the streams?    stackoverflow.com

I have a method that reads text from a file; decompression may be required, depending on an input parameter:

public static String readText(File inFile, boolean compressed) {
    InputStream in ...

12. How to Send a Password to Process in Java    stackoverflow.com

I am launching a process from java to run a command for me. This process runs for a little while, then needs a password to continue. Now I know that I ...

13. Java I/O read Delay    stackoverflow.com

When i try to read the InputStream , the reading takes a lot of time from the server . The process reads some bytes pauses for 5 mins , reads again ...

14. Java: transformation from byte to char and how to use dataOutputStream    stackoverflow.com

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestEOF {
    // Throw exceptions to console:
    public static void main(String[] args) throws IOException {
  ...

15. How to clear/reset/open an input stream so it can be used in 2 different methods in Java?    stackoverflow.com

Here's the code:

    package testpack;
    import java.io.*;

    public class InputStreamReadDemo {


        private void readByte() throws ...