public String readString ( String charset ) throws IOException { long len = readInt ( ) ; if ( len > available ( ) ) throw new IOException ( "Cannot read string of length " + len + " bytes when only " + available ( ) + " bytes are available" ) ; byte [ ] raw = new byte [ ( int ) len ] ; readFully ( raw ) ; if ( encode ) { return new String ( raw , charset ) ; } return new String ( raw ) ; }
Read a String from the array converting using the given character set .