There probably is a method to return the index of the first non-blank char in a String in Java5/6. But I cannot find it any more. A code anylizing tool says it is better than checking String.trim().length().
I'd use the Guava CharMatcher class:
boolean onlyWhitespace = CharMatcher.WHITESPACE.matchesAllOf(input);