public static String readString(DataInput input) throws IOException {
		short short1 = input.readShort();
	    if (short1 > 32767) {
	        throw new IOException("Received string length longer than 32767!");
	    }else if (short1 < 0) {
	        throw new IOException("Received string length is less than zero!");
	    }else {
	        StringBuilder stringbuilder = new StringBuilder();
	
	        for (int j = 0; j < short1; ++j) {
	            stringbuilder.append(input.readChar());
	        }
	
	        return stringbuilder.toString();
	    }
	}