Removed writer's count of bytes written and renamed a method.

This commit is contained in:
akwizgran
2011-09-21 18:22:14 +01:00
parent 52f3b70c3f
commit b65d6631f1
19 changed files with 34 additions and 60 deletions

View File

@@ -55,7 +55,7 @@ class AckWriterImpl implements AckWriter {
}
private void start() throws IOException {
w.writeUserDefinedTag(Types.ACK);
w.writeUserDefinedId(Types.ACK);
w.writeListStart();
capacity -= headerLength;
started = true;

View File

@@ -61,7 +61,7 @@ class BatchWriterImpl implements BatchWriter {
private void start() throws IOException {
messageDigest.reset();
w.writeUserDefinedTag(Types.BATCH);
w.writeUserDefinedId(Types.BATCH);
w.writeListStart();
capacity -= headerLength;
started = true;

View File

@@ -55,7 +55,7 @@ class OfferWriterImpl implements OfferWriter {
}
private void start() throws IOException {
w.writeUserDefinedTag(Types.OFFER);
w.writeUserDefinedId(Types.OFFER);
w.writeListStart();
capacity -= headerLength;
started = true;

View File

@@ -21,7 +21,7 @@ class RequestWriterImpl implements RequestWriter {
public void writeRequest(BitSet b, int length)
throws IOException {
w.writeUserDefinedTag(Types.REQUEST);
w.writeUserDefinedId(Types.REQUEST);
// If the number of bits isn't a multiple of 8, round up to a byte
int bytes = length % 8 == 0 ? length / 8 : length / 8 + 1;
byte[] bitmap = new byte[bytes];

View File

@@ -22,7 +22,7 @@ class SubscriptionWriterImpl implements SubscriptionWriter {
public void writeSubscriptions(Map<Group, Long> subs, long timestamp)
throws IOException {
w.writeUserDefinedTag(Types.SUBSCRIPTION_UPDATE);
w.writeUserDefinedId(Types.SUBSCRIPTION_UPDATE);
w.writeMap(subs);
w.writeInt64(timestamp);
out.flush();

View File

@@ -22,10 +22,10 @@ class TransportWriterImpl implements TransportWriter {
public void writeTransports(Map<String, Map<String, String>> transports,
long timestamp) throws IOException {
w.writeUserDefinedTag(Types.TRANSPORT_UPDATE);
w.writeUserDefinedId(Types.TRANSPORT_UPDATE);
w.writeListStart();
for(Entry<String, Map<String, String>> e : transports.entrySet()) {
w.writeUserDefinedTag(Types.TRANSPORT_PROPERTIES);
w.writeUserDefinedId(Types.TRANSPORT_PROPERTIES);
w.writeString(e.getKey());
w.writeMap(e.getValue());
}