Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.



Description This is a method for advanced programmers to open a Java InputStream. The method is useful if you want to use the facilities provided by PApplet to easily open files from the data folder or from a URL, but want an InputStream object so that you can use other Java methods to take more control of how the stream is read.

If the requested item doesn't exist, null is returned.

In earlier releases, this method was called openStream().

If not online, this will also check to see if the user is asking for a file whose name isn't properly capitalized. If capitalization is different an error will be printed to the console. This helps prevent issues that appear when a sketch is exported to the web, where case sensitivity matters, as opposed to running from inside the Processing Development Environment on Windows or Mac OS, where case sensitivity is preserved but ignored.

The filename passed in can be:
- A URL, for instance openStream("");
- A file in the sketch's data folder
- The full path to a file to be opened locally (when running as an application)

If the file ends with .gz, the stream will automatically be gzip decompressed. If you don't want the automatic decompression, use the related function createInputRaw().
filename String: the name of the file to use as input
Returns InputStream or null
Usage Application & Web
Related createOutput()
Updated on June 14, 2010 12:05:29pm EDT

Creative Commons License