createInput() \ Language (API) \ Processing 1.0
Author: Casey Reas & Ben Fry
Description: Processing is an electronic sketchbook for developing ideas. It is a context for learning fundamentals of computer programming within the context of the electronic arts.
Keywords: Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas

Reference for Processing version 1.5. 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.

Name | ### createInput()
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("http://processing.org/"); - 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().
Syntax |
    createInput(filename)
Parameters |
filename | String: the name of the file to use as input
Returns | InputStream or null
Usage | Application & Web
Related | createOutput() selectOutput() selectInput()

Updated on August 30, 2010 04:29:39pm EDT