comparison src/org/tmatesoft/hg/internal/DataAccess.java @ 421:fdd7d756dea0 v0.8.5

Allow IOException from DataAccess methods for subclasses with non-trivial implementations, to avoid exception dumps when inapropriate
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 23:09:11 +0100
parents 6c22bdc0bdfd
children 48f993aa2f41
comparison
equal deleted inserted replaced
420:6c22bdc0bdfd 421:fdd7d756dea0
27 * 27 *
28 * @author Artem Tikhomirov 28 * @author Artem Tikhomirov
29 * @author TMate Software Ltd. 29 * @author TMate Software Ltd.
30 */ 30 */
31 public class DataAccess { 31 public class DataAccess {
32 public boolean isEmpty() { 32 public boolean isEmpty() throws IOException {
33 return true; 33 return true;
34 } 34 }
35 // TODO throws IOException (few subclasses have non-trivial length() operation) 35 // IOException due to few subclasses that have non-trivial length() operation
36 // long length and offset are needed only in RevlogStream, makes no sense elsewhere 36 // long length and offset are needed only in RevlogStream, makes no sense elsewhere
37 // because chunks Mercurial operates with fit into int (4 bytes actualLength field) 37 // because chunks Mercurial operates with fit into int (4 bytes actualLength field)
38 // For those that may face large pieces of data (actual data streams) there are #longLength 38 // For those that may face large pieces of data (actual data streams) there are #longLength
39 // and #longSeek() to implement 39 // and #longSeek() to implement
40 public int length() { 40 public int length() throws IOException {
41 return 0; 41 return 0;
42 } 42 }
43 43
44 public long longLength() { 44 public long longLength() throws IOException {
45 return length(); 45 return length();
46 } 46 }
47 47
48 public void longSeek(long offset) throws IOException { 48 public void longSeek(long offset) throws IOException {
49 seek(Internals.ltoi(offset)); 49 seek(Internals.ltoi(offset));