MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / skip

Method skip

vm/JavaAPI/src/java/io/Reader.java:112–135  ·  view source on GitHub ↗

Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.

(long count)

Source from the content-addressed store, hash-verified

110 * Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.
111 */
112 public long skip(long count) throws java.io.IOException{
113 if (count < 0) {
114 throw new IllegalArgumentException();
115 }
116 synchronized (lock) {
117 long skipped = 0;
118 int toRead = count < 512 ? (int) count : 512;
119 char charsSkipped[] = new char[toRead];
120 while (skipped < count) {
121 int read = read(charsSkipped, 0, toRead);
122 if (read == -1) {
123 return skipped;
124 }
125 skipped += read;
126 if (read < toRead) {
127 return skipped;
128 }
129 if (count - skipped < toRead) {
130 toRead = (int) (count - skipped);
131 }
132 }
133 return skipped;
134 }
135 }
136
137}

Callers

nothing calls this directly

Calls 1

readMethod · 0.95

Tested by

no test coverage detected