How to Declare and Set an OutputStream

OutputStream was added in API Level 1
A writable sink for bytes. Most clients will use output streams that write data to the file system, the network, or to an in-memory byte array.

1. In the MainActivity.java file, add the line below to the imports section.

      import java.io.OutputStream;

2.Add the code below to the onCreate method. This will declare an OutputStream named myOutputStream and set it to null.

OutputStream myOutputStream = null;

3. Compile and run!

Next Recommended Article: How to Create a new FileOutputStream

Resources: