private int getLengthToRead() throws IOException { String length = read(SlimVersion.MINIMUM_NUMBER_LENGTH); //Continue to read up to the ":" String next; while (!":".equals(next = read(1)) && !isEof() && !isTimeout()) length = length + next; if (isEof()) throw new IOException("Stream Read Failure. Can't read length of message, EOF reached. Possibly test aborted. Last things read: " + length); if (isTimeout()) throw new IOException("Stream Read Failure. Can't read length of message, Timeout reached. Possibly test aborted. Last things read: " + length); try { Integer resultLength = Integer.parseInt(length); return resultLength; } catch (NumberFormatException e) { throw new IOException("Stream Read Failure. Can't read length of message, not a number. Possibly test aborted. Last things read: " + length); } }
private int getLengthToRead() throws IOException { String length = read(SlimVersion.MINIMUM_NUMBER_LENGTH); //Continue to read up to the ":" String next; while (!":".equals(next = read(1)) && !isEof() && !isTimeout()) length = length + next; if (isEof()) throw new IOException("Stream Read Failure. Can't read length of message, EOF reached. Possibly test aborted. Last things read: " + length); if (isTimeout()) throw new IOException("Stream Read Failure. Can't read length of message, Timeout reached. Possibly test aborted. Last things read: " + length); try { Integer resultLength = Integer.parseInt(length); return resultLength; } catch (NumberFormatException e) { throw new IOException("Stream Read Failure. Can't read length of message, not a number. Possibly test aborted. Last things read: " + length); } }