Class StringIO

java.lang.Object
com.sun.j3d.utils.shader.StringIO

public class StringIO extends Object
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 Type
    Method
    Description
    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 InputStream and return a single String object containing the contents of the InputStream.
    static String
    readFully(Reader reader)
    Read the entire contents of the specified Reader and return a single String object containing the contents of the InputStream.
    static String
    readFully(String fileName)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • readFully

      public static String readFully(String fileName) throws IOException
      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

      public static String readFully(File file) throws IOException
      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

      public static String readFully(URL url) throws IOException
      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

      public static String readFully(InputStream stream) throws IOException
      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

      public static String readFully(Reader reader) throws IOException
      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