Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/DataAccess.java @ 398:c76c57f6b961
Merge fixed for issue 24 and issue 26 from smartgit3 branch
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 23 Feb 2012 21:53:21 +0100 |
parents | 5e95b0da26f2 |
children | fdc1db8f7f61 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DataAccess.java Thu Feb 23 01:06:24 2012 +0100 +++ b/src/org/tmatesoft/hg/internal/DataAccess.java Thu Feb 23 21:53:21 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2011 TMate Software Ltd + * Copyright (c) 2010-2012 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,11 +46,18 @@ } // absolute positioning public void seek(int offset) throws IOException { - throw new UnsupportedOperationException(); + if (offset == 0) { + // perfectly OK for the "empty slice" instance + return; + } + throw new IOException(String.format("No data, can't seek %d bytes", offset)); } // relative positioning public void skip(int bytes) throws IOException { - throw new UnsupportedOperationException(); + if (bytes == 0) { + return; + } + throw new IOException(String.format("No data, can't skip %d bytes", bytes)); } // shall be called once this object no longer needed public void done() { @@ -69,7 +76,10 @@ return ((long) i1) << 32 | ((long) i2 & 0xFFFFFFFFl); } public void readBytes(byte[] buf, int offset, int length) throws IOException { - throw new UnsupportedOperationException(); + if (length == 0) { + return; + } + throw new IOException(String.format("No data, can't read %d bytes", length)); } // reads bytes into ByteBuffer, up to its limit or total data length, whichever smaller // FIXME perhaps, in DataAccess paradigm (when we read known number of bytes, we shall pass specific byte count to read)