/** * Ensures that the buffer contains at least n bytes. This method invalidates the buffer and index * fields. * * @param n The amount of bytes to ensure exists in buffer * @return true if required bytes are available and false if EOF * @throws IOException If reading of the wrapped stream failed. */ public boolean ensureBytes(int n) throws IOException { int required = n - endIndex + index; while (required > 0) { if (!readMore(required)) { return false; } required = n - endIndex + index; } return true; }
/** * Ensures that the buffer contains at least n bytes. * This method invalidates the buffer and index fields. * * @param n The amount of bytes to ensure exists in buffer * @return true if required bytes are available and false if EOF * @throws IOException If reading of the wrapped stream failed. */ public boolean ensureBytes(int n) throws IOException { int required = n - endIndex + index; while (required > 0) { if (!readMore(required)) { return false; } required = n - endIndex + index; } return true; }
/** * Scans the length of the next null terminated string (C-style string) from the stream. * * @return The length of the next null terminated string. * @throws IOException If reading of stream fails. * @throws EOFException If the stream did not contain any null terminators. */ public int scanCStringLength() throws IOException { int pos = index; while (true) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }
/** * Scans the length of the next null terminated string (C-style string) from * the stream. * * @return The length of the next null terminated string. * @throws IOException If reading of stream fails. * @throws EOFxception If the stream did not contain any null terminators. */ public int scanCStringLength() throws IOException { int pos = index; for (;;) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }
/** * Ensures that the buffer contains at least n bytes. * This method invalidates the buffer and index fields. * * @param n The amount of bytes to ensure exists in buffer * @return true if required bytes are available and false if EOF * @throws IOException If reading of the wrapped stream failed. */ public boolean ensureBytes(int n) throws IOException { int required = n - endIndex + index; while (required > 0) { if (!readMore(required)) { return false; } required = n - endIndex + index; } return true; }
/** * Ensures that the buffer contains at least n bytes. * This method invalidates the buffer and index fields. * * @param n The amount of bytes to ensure exists in buffer * @return true if required bytes are available and false if EOF * @throws IOException If reading of the wrapped stream failed. */ public boolean ensureBytes(int n) throws IOException { int required = n - endIndex + index; while (required > 0) { if (!readMore(required)) { return false; } required = n - endIndex + index; } return true; }
/** * Scans the length of the next null terminated string (C-style string) from * the stream. * * @return The length of the next null terminated string. * @throws IOException If reading of stream fails. * @throws EOFxception If the stream did not contain any null terminators. */ public int scanCStringLength() throws IOException { int pos = index; for (;;) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }
/** * Scans the length of the next null terminated string (C-style string) from * the stream. * * @return The length of the next null terminated string. * @throws IOException If reading of stream fails. * @throws EOFxception If the stream did not contain any null terminators. */ public int scanCStringLength() throws IOException { int pos = index; for (;;) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }