mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Renamed serial component to data, moved consumers to briar-core.
This commit is contained in:
10
briar-api/src/org/briarproject/api/data/Consumer.java
Normal file
10
briar-api/src/org/briarproject/api/data/Consumer.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface Consumer {
|
||||
|
||||
void write(byte b) throws IOException;
|
||||
|
||||
void write(byte[] b, int off, int len) throws IOException;
|
||||
}
|
||||
12
briar-api/src/org/briarproject/api/data/DataConstants.java
Normal file
12
briar-api/src/org/briarproject/api/data/DataConstants.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import org.briarproject.api.UniqueId;
|
||||
|
||||
public interface DataConstants {
|
||||
|
||||
int LIST_START_LENGTH = 1;
|
||||
|
||||
int LIST_END_LENGTH = 1;
|
||||
|
||||
int UNIQUE_ID_LENGTH = 2 + UniqueId.LENGTH;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface ObjectReader<T> {
|
||||
|
||||
T readObject(Reader r) throws IOException;
|
||||
}
|
||||
48
briar-api/src/org/briarproject/api/data/Reader.java
Normal file
48
briar-api/src/org/briarproject/api/data/Reader.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface Reader {
|
||||
|
||||
boolean eof() throws IOException;
|
||||
void close() throws IOException;
|
||||
|
||||
void addConsumer(Consumer c);
|
||||
void removeConsumer(Consumer c);
|
||||
|
||||
boolean hasNull() throws IOException;
|
||||
void readNull() throws IOException;
|
||||
void skipNull() throws IOException;
|
||||
|
||||
boolean hasBoolean() throws IOException;
|
||||
boolean readBoolean() throws IOException;
|
||||
void skipBoolean() throws IOException;
|
||||
|
||||
boolean hasInteger() throws IOException;
|
||||
long readInteger() throws IOException;
|
||||
void skipInteger() throws IOException;
|
||||
|
||||
boolean hasFloat() throws IOException;
|
||||
double readFloat() throws IOException;
|
||||
void skipFloat() throws IOException;
|
||||
|
||||
boolean hasString() throws IOException;
|
||||
String readString(int maxLength) throws IOException;
|
||||
void skipString() throws IOException;
|
||||
|
||||
boolean hasBytes() throws IOException;
|
||||
byte[] readBytes(int maxLength) throws IOException;
|
||||
void skipBytes() throws IOException;
|
||||
|
||||
boolean hasList() throws IOException;
|
||||
void readListStart() throws IOException;
|
||||
boolean hasListEnd() throws IOException;
|
||||
void readListEnd() throws IOException;
|
||||
void skipList() throws IOException;
|
||||
|
||||
boolean hasMap() throws IOException;
|
||||
void readMapStart() throws IOException;
|
||||
boolean hasMapEnd() throws IOException;
|
||||
void readMapEnd() throws IOException;
|
||||
void skipMap() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface ReaderFactory {
|
||||
|
||||
Reader createReader(InputStream in);
|
||||
}
|
||||
29
briar-api/src/org/briarproject/api/data/Writer.java
Normal file
29
briar-api/src/org/briarproject/api/data/Writer.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public interface Writer {
|
||||
|
||||
void flush() throws IOException;
|
||||
void close() throws IOException;
|
||||
|
||||
void addConsumer(Consumer c);
|
||||
void removeConsumer(Consumer c);
|
||||
|
||||
void writeNull() throws IOException;
|
||||
void writeBoolean(boolean b) throws IOException;
|
||||
void writeInteger(long l) throws IOException;
|
||||
void writeFloat(double d) throws IOException;
|
||||
void writeString(String s) throws IOException;
|
||||
void writeBytes(byte[] b) throws IOException;
|
||||
|
||||
void writeList(Collection<?> c) throws IOException;
|
||||
void writeListStart() throws IOException;
|
||||
void writeListEnd() throws IOException;
|
||||
|
||||
void writeMap(Map<?, ?> m) throws IOException;
|
||||
void writeMapStart() throws IOException;
|
||||
void writeMapEnd() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.briarproject.api.data;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
public interface WriterFactory {
|
||||
|
||||
Writer createWriter(OutputStream out);
|
||||
}
|
||||
Reference in New Issue
Block a user