/** * Non-destructive one-character look-ahead. * * @return If not eof, the next character that would be read. If eof, -1. */ @Override public int peek() { try { mark(2); // Two characters required here as the next read will collapse \r\n to a single \n final int ret = read(); reset(); return ret; } catch (IOException e) { throw new RuntimeIOException(e); } }
/** * Non-destructive one-character look-ahead. * * @return If not eof, the next character that would be read. If eof, -1. */ @Override public int peek() { try { mark(2); // Two characters required here as the next read will collapse \r\n to a single \n final int ret = read(); reset(); return ret; } catch (IOException e) { throw new RuntimeIOException(e); } }