374 |
* |
* |
375 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
376 |
*/ |
*/ |
377 |
public long skip(long count) throws IOException |
public long skip (long count) throws IOException |
378 |
{ |
{ |
|
return(super.skip(count)); |
|
|
// FIXME: This method not merged from gcj. The code below is the original |
|
|
// gcj code that doesn't work. I'm not sure if the method above (from |
|
|
// Classpath) is broken or not, but it seems to work correctly in all |
|
|
// methods I've tested. If somebody wants to investigate why the code |
|
|
// below fails, feel free. |
|
|
/* |
|
379 |
if (count <= 0) |
if (count <= 0) |
380 |
return 0; |
return 0; |
381 |
long to_do = count; |
|
382 |
do |
int skipped; |
383 |
|
|
384 |
|
for (skipped = 0; skipped < count; skipped++) |
385 |
{ |
{ |
386 |
int ch = read(); |
int ch = read(); |
387 |
if (ch < 0) |
|
388 |
break; |
if (ch < 0) |
389 |
to_do--; |
break; |
|
if (ch == '\n' || ch == '\r') |
|
|
lineNumber++; |
|
|
else |
|
|
{ |
|
|
long fence = pos + to_do; |
|
|
if (limit < fence) |
|
|
fence = limit; |
|
|
int end = pos; |
|
|
for (; end < fence; end++) |
|
|
{ |
|
|
char endch = buffer[end]; |
|
|
if (endch == '\n' || endch == '\r') |
|
|
break; |
|
|
} |
|
|
to_do -= end - pos; |
|
|
pos = end; |
|
|
} |
|
390 |
} |
} |
391 |
while (to_do > 0); |
|
392 |
return count - to_do; |
return skipped; |
|
*/ |
|
393 |
} |
} |
394 |
} |
} |
395 |
|
|