mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 13:19:52 +01:00
Refactored readers and writers.
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
package net.sf.briar.api.serial;
|
||||
|
||||
public class FormatRuntimeException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -6548900875808933998L;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package net.sf.briar.api.serial;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public interface Reader {
|
||||
|
||||
boolean eof() throws IOException;
|
||||
void setReadLimit(long limit);
|
||||
void resetReadLimit();
|
||||
|
||||
boolean hasBoolean() throws IOException;
|
||||
boolean readBoolean() throws IOException;
|
||||
@@ -33,23 +33,24 @@ public interface Reader {
|
||||
|
||||
boolean hasUtf8() throws IOException;
|
||||
String readUtf8() throws IOException;
|
||||
String readUtf8(int maxLength) throws IOException;
|
||||
|
||||
boolean hasRaw() throws IOException;
|
||||
byte[] readRaw() throws IOException;
|
||||
byte[] readRaw(int maxLength) throws IOException;
|
||||
|
||||
boolean hasList() throws IOException;
|
||||
List<Object> readList() throws IOException;
|
||||
Iterator<Object> readListElements() throws IOException;
|
||||
<E> List<E> readList(Class<E> e) throws IOException;
|
||||
<E> Iterator<E> readListElements(Class<E> e) throws IOException;
|
||||
boolean hasListStart() throws IOException;
|
||||
void readListStart() throws IOException;
|
||||
boolean hasListEnd() throws IOException;
|
||||
void readListEnd() throws IOException;
|
||||
|
||||
boolean hasMap() throws IOException;
|
||||
Map<Object, Object> readMap() throws IOException;
|
||||
Iterator<Entry<Object, Object>> readMapEntries() throws IOException;
|
||||
<K, V> Map<K, V> readMap(Class<K> k, Class<V> v) throws IOException;
|
||||
<K, V> Iterator<Entry<K, V>> readMapEntries(Class<K> k, Class<V> v) throws IOException;
|
||||
boolean hasMapStart() throws IOException;
|
||||
void readMapStart() throws IOException;
|
||||
boolean hasMapEnd() throws IOException;
|
||||
void readMapEnd() throws IOException;
|
||||
|
||||
boolean hasNull() throws IOException;
|
||||
void readNull() throws IOException;
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.sf.briar.api.serial;
|
||||
|
||||
public interface Tag {
|
||||
|
||||
// FIXME: Definite lists and maps
|
||||
public static final byte FALSE = -1, TRUE = -2;
|
||||
public static final byte INT8 = -3, INT16 = -4, INT32 = -5, INT64 = -6;
|
||||
public static final byte FLOAT32 = -7, FLOAT64 = -8;
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface Writer {
|
||||
void writeMapEnd() throws IOException;
|
||||
|
||||
void writeNull() throws IOException;
|
||||
|
||||
void close() throws IOException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user