Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/DataSerializer.java @ 628:6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 22 May 2013 15:52:31 +0200 |
parents | 7c0d2ce340b8 |
children | 14dac192aa26 |
comparison
equal
deleted
inserted
replaced
627:5153eb73b18d | 628:6526d8adbc0f |
---|---|
17 package org.tmatesoft.hg.internal; | 17 package org.tmatesoft.hg.internal; |
18 | 18 |
19 import java.io.ByteArrayOutputStream; | 19 import java.io.ByteArrayOutputStream; |
20 | 20 |
21 import org.tmatesoft.hg.core.HgIOException; | 21 import org.tmatesoft.hg.core.HgIOException; |
22 import org.tmatesoft.hg.repo.HgRuntimeException; | |
22 | 23 |
23 /** | 24 /** |
24 * Serialization friend of {@link DataAccess} | 25 * Serialization friend of {@link DataAccess} |
25 * | 26 * |
26 * @author Artem Tikhomirov | 27 * @author Artem Tikhomirov |
76 interface DataSource { | 77 interface DataSource { |
77 /** | 78 /** |
78 * Invoked once for a single write operation, | 79 * Invoked once for a single write operation, |
79 * although the source itself may get serialized several times | 80 * although the source itself may get serialized several times |
80 */ | 81 */ |
81 public void serialize(DataSerializer out) throws HgIOException; | 82 public void serialize(DataSerializer out) throws HgIOException, HgRuntimeException; |
82 | 83 |
83 /** | 84 /** |
84 * Hint of data length it would like to writes | 85 * Hint of data length it would like to writes |
85 * @return -1 if can't answer | 86 * @return -1 if can't answer |
86 */ | 87 */ |
87 public int serializeLength(); | 88 public int serializeLength() throws HgRuntimeException; |
88 } | 89 } |
89 | 90 |
90 public static class ByteArrayDataSource implements DataSource { | 91 public static class ByteArrayDataSource implements DataSource { |
91 | 92 |
92 private final byte[] data; | 93 private final byte[] data; |