org.progeeks.util
Class StringUtils

java.lang.Object
  extended by org.progeeks.util.StringUtils

public class StringUtils
extends java.lang.Object

Utilities for loading and manipulating strings.

Version:
$Revision: 1.5 $
Author:
Paul Speed

Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String detectIndent(java.lang.String s)
          Attempts to detect the current indent by looking at the last line of the text.
static java.lang.String readFile(java.io.File f)
          Loads the contents of the specified file as a string and returns it.
static java.lang.String readString(java.io.Reader r)
          Loads the contents of the specified reader as a string and returns it.
static java.lang.String readStringResource(java.lang.Class c, java.lang.String resource)
          Loads the contents of the specified resource as a string and returns it.
static void writeFile(java.lang.String s, java.io.File f)
          Writes the string to the specified file.
static void writeString(java.lang.String s, java.io.Writer out)
          Writes the string data to the specified writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

detectIndent

public static java.lang.String detectIndent(java.lang.String s)
Attempts to detect the current indent by looking at the last line of the text. The indent is returned as a raw string of whitespace.


readStringResource

public static java.lang.String readStringResource(java.lang.Class c,
                                                  java.lang.String resource)
                                           throws java.io.IOException
Loads the contents of the specified resource as a string and returns it.

Throws:
java.io.IOException

readString

public static java.lang.String readString(java.io.Reader r)
                                   throws java.io.IOException
Loads the contents of the specified reader as a string and returns it.

Throws:
java.io.IOException

readFile

public static java.lang.String readFile(java.io.File f)
                                 throws java.io.IOException
Loads the contents of the specified file as a string and returns it.

Throws:
java.io.IOException

writeString

public static void writeString(java.lang.String s,
                               java.io.Writer out)
                        throws java.io.IOException
Writes the string data to the specified writer.

Throws:
java.io.IOException

writeFile

public static void writeFile(java.lang.String s,
                             java.io.File f)
                      throws java.io.IOException
Writes the string to the specified file.

Throws:
java.io.IOException


Copyright © 2002-2003 Paul Speed. All Rights Reserved.