Some code style improvements
This commit is contained in:
parent
6d67598a40
commit
c11a1b78c4
@ -84,7 +84,7 @@ public class Message implements ExtendedEncoding.ExtendedType {
|
|||||||
}
|
}
|
||||||
packer.packMapHeader(size);
|
packer.packMapHeader(size);
|
||||||
packer.packString("");
|
packer.packString("");
|
||||||
packer.packString("message");
|
packer.packString(TYPE);
|
||||||
packer.packString("subject");
|
packer.packString("subject");
|
||||||
packer.packString(subject);
|
packer.packString(subject);
|
||||||
packer.packString("body");
|
packer.packString("body");
|
||||||
|
@ -58,7 +58,7 @@ public class Vote implements ExtendedEncoding.ExtendedType {
|
|||||||
public void pack(MessagePacker packer) throws IOException {
|
public void pack(MessagePacker packer) throws IOException {
|
||||||
packer.packMapHeader(3);
|
packer.packMapHeader(3);
|
||||||
packer.packString("");
|
packer.packString("");
|
||||||
packer.packString("vote");
|
packer.packString(TYPE);
|
||||||
packer.packString("msgId");
|
packer.packString("msgId");
|
||||||
packer.packBinaryHeader(msgId.getHash().length);
|
packer.packBinaryHeader(msgId.getHash().length);
|
||||||
packer.writePayload(msgId.getHash());
|
packer.writePayload(msgId.getHash());
|
||||||
|
@ -22,6 +22,7 @@ import java.util.zip.InflaterInputStream;
|
|||||||
public class ExtendedEncodingFactory {
|
public class ExtendedEncodingFactory {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ExtendedEncodingFactory.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ExtendedEncodingFactory.class);
|
||||||
private static final ExtendedEncodingFactory INSTANCE = new ExtendedEncodingFactory();
|
private static final ExtendedEncodingFactory INSTANCE = new ExtendedEncodingFactory();
|
||||||
|
private static final String KEY_MESSAGE_TYPE = "";
|
||||||
private Map<String, ExtendedEncoding.Unpacker<?>> factories = new HashMap<>();
|
private Map<String, ExtendedEncoding.Unpacker<?>> factories = new HashMap<>();
|
||||||
|
|
||||||
private ExtendedEncodingFactory() {
|
private ExtendedEncodingFactory() {
|
||||||
@ -39,7 +40,7 @@ public class ExtendedEncodingFactory {
|
|||||||
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(unzipper);
|
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(unzipper);
|
||||||
int mapSize = unpacker.unpackMapHeader();
|
int mapSize = unpacker.unpackMapHeader();
|
||||||
String key = unpacker.unpackString();
|
String key = unpacker.unpackString();
|
||||||
if (!"".equals(key)) {
|
if (!KEY_MESSAGE_TYPE.equals(key)) {
|
||||||
LOG.error("Unexpected content: " + key);
|
LOG.error("Unexpected content: " + key);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,6 @@
|
|||||||
|
|
||||||
package ch.dissem.bitmessage.utils;
|
package ch.dissem.bitmessage.utils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for working with byte arrays interpreted as unsigned big endian integers.
|
* A helper class for working with byte arrays interpreted as unsigned big endian integers.
|
||||||
* This is one part due to the fact that Java doesn't support unsigned numbers, and another
|
* This is one part due to the fact that Java doesn't support unsigned numbers, and another
|
||||||
|
Loading…
Reference in New Issue
Block a user