MCPcopy Create free account
hub / github.com/davidgiven/luje / skip

Method skip

lib/java/io/Reader.java:220–243  ·  view source on GitHub ↗

Skips amount characters in this reader. Subsequent calls of read methods will not return these characters unless reset() is used. This method may perform multiple reads to read count characters. @param count the maximum number of characters to skip. @retur

(long count)

Source from the content-addressed store, hash-verified

218 * @see #reset()
219 */
220 public long skip(long count) throws IOException {
221 if (count < 0) {
222 throw new IllegalArgumentException();
223 }
224 synchronized (lock) {
225 long skipped = 0;
226 int toRead = count < 512 ? (int) count : 512;
227 char charsSkipped[] = new char[toRead];
228 while (skipped < count) {
229 int read = read(charsSkipped, 0, toRead);
230 if (read == -1) {
231 return skipped;
232 }
233 skipped += read;
234 if (read < toRead) {
235 return skipped;
236 }
237 if (count - skipped < toRead) {
238 toRead = (int) (count - skipped);
239 }
240 }
241 return skipped;
242 }
243 }
244
245 /**
246 * Reads characters and puts them into the {@code target} character buffer.

Callers

nothing calls this directly

Calls 1

readMethod · 0.95

Tested by

no test coverage detected