@@ -153,7 +153,7 @@ public int readSync(long pos, ByteBuffer buffer) throws IOException {
153
153
if (waitForData .hasError () && !eof )
154
154
throw new OutputToInputTransferException (waitForData .getError ());
155
155
synchronized (waitForData ) {
156
- if (pos >= writePos && waitForData .isDone ())
156
+ if (pos >= writePos && waitForData .isSuccessful ())
157
157
waitForData .reset ();
158
158
}
159
159
waitForData .block (0 );
@@ -210,7 +210,7 @@ public AsyncSupplier<Integer, IOException> readAsync(long pos, ByteBuffer buffer
210
210
}
211
211
AsyncSupplier <Integer , IOException > result = new AsyncSupplier <>();
212
212
synchronized (waitForData ) {
213
- if (pos >= writePos && waitForData .isDone ())
213
+ if (pos >= writePos && waitForData .isSuccessful ())
214
214
waitForData .reset ();
215
215
}
216
216
waitForData .thenStart (operation (
@@ -282,7 +282,7 @@ public long skipSync(long n) throws IOException {
282
282
if (waitForData .hasError () && !eof )
283
283
throw new OutputToInputTransferException (waitForData .getError ());
284
284
synchronized (waitForData ) {
285
- if (readPos + n > writePos && waitForData .isDone ())
285
+ if (readPos + n > writePos && waitForData .isSuccessful ())
286
286
waitForData .reset ();
287
287
}
288
288
waitForData .block (0 );
@@ -311,9 +311,10 @@ public AsyncSupplier<Long, IOException> skipAsync(long n, Consumer<Pair<Long,IOE
311
311
if (ondone != null ) ondone .accept (new Pair <>(Long .valueOf (m ), null ));
312
312
return new AsyncSupplier <>(Long .valueOf (m ), null );
313
313
}
314
+ if (waitForData .hasError ()) return IOUtil .error (waitForData .getError (), ondone );
314
315
AsyncSupplier <Long , IOException > result = new AsyncSupplier <>();
315
316
synchronized (waitForData ) {
316
- if (readPos + n > writePos && waitForData .isDone ())
317
+ if (readPos + n > writePos && waitForData .isSuccessful ())
317
318
waitForData .reset ();
318
319
}
319
320
waitForData .thenStart (operation (taskSyncToAsync ("OutputToInput.skipAsync" , result , ondone , () -> Long .valueOf (skipSync (n )))), true );
@@ -338,7 +339,7 @@ public long seekSync(SeekType type, long move) throws IOException {
338
339
default : //case FROM_END:
339
340
while (!eof && !waitForData .hasError ()) {
340
341
synchronized (waitForData ) {
341
- if (!eof && waitForData .isDone ())
342
+ if (!eof && waitForData .isSuccessful ())
342
343
waitForData .reset ();
343
344
}
344
345
waitForData .block (0 );
@@ -383,7 +384,7 @@ public AsyncSupplier<Long, IOException> seekAsync(SeekType type, long move, Cons
383
384
}
384
385
AsyncSupplier <Long , IOException > result = new AsyncSupplier <>();
385
386
synchronized (waitForData ) {
386
- if (!eof && waitForData .isDone ())
387
+ if (!eof && waitForData .isSuccessful ())
387
388
waitForData .reset ();
388
389
}
389
390
waitForData .thenStart (operation (Task .cpu ("OutputToInput.seekAsync" , io .getPriority (), t -> {
0 commit comments