public String[] readCmd() throws IOException {
		if( chunkLeft > 0 ) throw new IOException("Cannot read command; there are "+chunkLeft+" chunk bytes left to be read");
		
		int lineLength;
		do {
			lineLength = readLine( cmdBuffer );
		} while( lineLength >= 0 && isEntirelyWhitespace( cmdBuffer, lineLength ) );
		if( lineLength < 0 ) return null;
		List<String> words = new ArrayList<String>();
		StringBuilder sb = new StringBuilder();
		for( int i=0; i<lineLength; ++i ) {
			if( isWhitespace(cmdBuffer[i]) ) {
				flushWord( sb, words );
			} else {
				sb.append( (char)cmdBuffer[i] );
			}
		}
		flushWord( sb, words );
		String[] r = words.toArray(new String[words.size()]);
		if( debugPrefix != null ) System.err.println( debugPrefix + CmdWriter.encode(r) );
		return r;
	}