private String readValue(InputStream inputStream, int stringLength) throws IOException, InvalidFormatException {
        byte[] bytes = new byte[stringLength];
        int readBytes = inputStream.read(bytes);
        if (readBytes < stringLength) {
            throw new InvalidFormatException();
        }
        return new String(bytes);
    }