You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/SeekableByteChannelPrefetcher.java
+33-14Lines changed: 33 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@
16
16
17
17
packagecom.google.cloud.storage.contrib.nio;
18
18
19
-
importcom.google.common.base.Stopwatch;
20
19
importcom.google.common.util.concurrent.Futures;
21
20
22
21
importjava.io.Closeable;
@@ -65,7 +64,7 @@ public class SeekableByteChannelPrefetcher implements SeekableByteChannel {
65
64
// size of the underlying channel(s).
66
65
privatefinallongsize;
67
66
// where we pretend to be, wrt returning bytes from read()
68
-
privatelongposition = 0;
67
+
privatelongposition;
69
68
// whether we're open.
70
69
privatebooleanopen = true;
71
70
privatebooleanclosing = false;
@@ -169,6 +168,7 @@ public SeekableByteChannelPrefetcher(SeekableByteChannelPrefetcherOptions opts,
169
168
idleWorkers.add(newWorker(bc));
170
169
}
171
170
size = chan.size();
171
+
position = 0;
172
172
}
173
173
174
174
/**
@@ -178,7 +178,9 @@ public SeekableByteChannelPrefetcher(SeekableByteChannelPrefetcherOptions opts,
178
178
*/
179
179
@Override
180
180
publicintread(ByteBufferdst) throwsIOException {
181
-
if (!open) thrownewClosedChannelException();
181
+
if (!open) {
182
+
thrownewClosedChannelException();
183
+
}
182
184
ByteBuffersrc;
183
185
try {
184
186
src = fetch(position);
@@ -229,7 +231,9 @@ public int write(ByteBuffer src) throws IOException {
229
231
*/
230
232
@Override
231
233
publiclongposition() throwsIOException {
232
-
if (!open) thrownewClosedChannelException();
234
+
if (!open) {
235
+
thrownewClosedChannelException();
236
+
}
233
237
returnposition;
234
238
}
235
239
@@ -258,7 +262,9 @@ public long position() throws IOException {
0 commit comments