Package com.sun.j3d.utils.shader
Class StringIO
java.lang.Object
com.sun.j3d.utils.shader.StringIO
Utility class with static methods to read the entire contents of a
file, URL, InputStream, or Reader into a single String that is
returned to the user.
- Since:
- Java 3D 1.4
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Read the entire contents of the specified file and return a single String object containing the contents of the file.static String
readFully
(InputStream stream) Read the entire contents of the specified InputStream and return a single String object containing the contents of the InputStream.static String
Read the entire contents of the specified Reader and return a single String object containing the contents of the InputStream.static String
Read the entire contents of the specified file and return a single String object containing the contents of the file.static String
Read the entire contents of the specified URL and return a single String object containing the contents of the URL.
-
Method Details
-
readFully
Read the entire contents of the specified file and return a single String object containing the contents of the file.- Parameters:
fileName
- the name of the file from which to read- Returns:
- a String containing the contents of the input file
- Throws:
IOException
- if the specified file cannot be opened, or if an I/O error occurs while reading the file
-
readFully
Read the entire contents of the specified file and return a single String object containing the contents of the file. This method does not return until the end of the input file is reached.- Parameters:
file
- a File from which to read- Returns:
- a String containing the contents of the input file
- Throws:
IOException
- if the specified file cannot be opened, or if an I/O error occurs while reading the file
-
readFully
Read the entire contents of the specified URL and return a single String object containing the contents of the URL. This method does not return until an end of stream is reached for the URL.- Parameters:
url
- a URL from which to read- Returns:
- a String containing the contents of the input URL
- Throws:
IOException
- if the specified URL cannot be opened, or if an I/O error occurs while reading the URL
-
readFully
Read the entire contents of the specified InputStream and return a single String object containing the contents of the InputStream. This method does not return until the end of the input stream is reached.- Parameters:
stream
- an InputStream from which to read- Returns:
- a String containing the contents of the input stream
- Throws:
IOException
- if an I/O error occurs while reading the input stream
-
readFully
Read the entire contents of the specified Reader and return a single String object containing the contents of the InputStream. This method does not return until the end of the input file or stream is reached.- Parameters:
reader
- a Reader from which to read- Returns:
- a String containing the contents of the stream
- Throws:
IOException
- if an I/O error occurs while reading the input stream
-