comparison src/org/tmatesoft/hg/internal/DataAccessProvider.java @ 414:bb278ccf9866

Pull changes from smartgit3 branch
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 21 Mar 2012 20:51:12 +0100
parents 0ae53c32ecef 31a719b9f95e
children 6c22bdc0bdfd
comparison
equal deleted inserted replaced
413:7f27122011c3 414:bb278ccf9866
235 } 235 }
236 236
237 @Override 237 @Override
238 public void seek(int offset) throws IOException { 238 public void seek(int offset) throws IOException {
239 if (offset > size) { 239 if (offset > size) {
240 throw new IllegalArgumentException(); 240 throw new IllegalArgumentException(String.format("Can't seek to %d for the file of size %d (buffer start:%d)", offset, size, bufferStartInFile));
241 } 241 }
242 if (offset < bufferStartInFile + buffer.limit() && offset >= bufferStartInFile) { 242 if (offset < bufferStartInFile + buffer.limit() && offset >= bufferStartInFile) {
243 buffer.position((int) (offset - bufferStartInFile)); 243 buffer.position((int) (offset - bufferStartInFile));
244 } else { 244 } else {
245 // out of current buffer, invalidate it (force re-read) 245 // out of current buffer, invalidate it (force re-read)