public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void write(final byte[] bytes, final int off, final int len) throws IOException { if (len < 1) { return; } final int bl = buffer.length; final int position = this.position; if (len > bl - position || len > bl >> 1) { flush(); if (len < 256) { riverMarshaller.write(Protocol.ID_START_BLOCK_SMALL); riverMarshaller.writeByte(len); riverMarshaller.write(bytes, off, len); } else if (len < 65536) { riverMarshaller.write(Protocol.ID_START_BLOCK_MEDIUM); riverMarshaller.writeShort(len); riverMarshaller.write(bytes, off, len); } else { riverMarshaller.write(Protocol.ID_START_BLOCK_LARGE); riverMarshaller.writeInt(len); riverMarshaller.write(bytes, off, len); } } else { System.arraycopy(bytes, off, buffer, position, len); this.position = position + len; } }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } else { write(ID_REPEAT_CLASS_FAR); writeInt(i); } return true; } return false; }
writeShort(0); break;
} else if (diff >= -65536) { write(ID_REPEAT_OBJECT_NEARISH); writeShort(diff); } else { write(ID_REPEAT_OBJECT_FAR); writeShort(((Short) obj).shortValue()); return; } else if (len <= 0x10000) { write(ID_STRING_MEDIUM); writeShort(len); } else { write(ID_STRING_LARGE); } else if (len <= 65536) { write(unshared ? ID_ARRAY_MEDIUM_UNSHARED : ID_ARRAY_MEDIUM); writeShort(len); write(ID_PRIM_BYTE); write(bytes, 0, len); } else if (len <= 65536) { write(unshared ? ID_ARRAY_MEDIUM_UNSHARED : ID_ARRAY_MEDIUM); writeShort(len); write(ID_PRIM_BOOLEAN); writeBooleanArray(booleans); writeShort(len); write(ID_PRIM_CHAR);
writeShort(serializableField.isAccessible() ? serializableField.getShort(obj) : 0); break;
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void flush() throws IOException { final int position = this.position; if (position == 0) { return; } final RiverMarshaller marshaller = riverMarshaller; if (position < 256) { marshaller.write(Protocol.ID_START_BLOCK_SMALL); marshaller.writeByte(position); } else if (position < 65536) { marshaller.write(Protocol.ID_START_BLOCK_MEDIUM); marshaller.writeShort(position); } else { marshaller.write(Protocol.ID_START_BLOCK_LARGE); marshaller.writeInt(position); } marshaller.write(buffer, 0, position); this.position = 0; }
public void write(final byte[] bytes, final int off, final int len) throws IOException { if (len < 1) { return; } final int bl = buffer.length; final int position = this.position; if (len > bl - position || len > bl >> 1) { flush(); if (len < 256) { riverMarshaller.write(Protocol.ID_START_BLOCK_SMALL); riverMarshaller.writeByte(len); riverMarshaller.write(bytes, off, len); } else if (len < 65536) { riverMarshaller.write(Protocol.ID_START_BLOCK_MEDIUM); riverMarshaller.writeShort(len); riverMarshaller.write(bytes, off, len); } else { riverMarshaller.write(Protocol.ID_START_BLOCK_LARGE); riverMarshaller.writeInt(len); riverMarshaller.write(bytes, off, len); } } else { System.arraycopy(bytes, off, buffer, position, len); this.position = position + len; } }
public void write(final byte[] bytes, final int off, final int len) throws IOException { if (len < 1) { return; } final int bl = buffer.length; final int position = this.position; if (len > bl - position || len > bl >> 1) { flush(); if (len < 256) { riverMarshaller.write(Protocol.ID_START_BLOCK_SMALL); riverMarshaller.writeByte(len); riverMarshaller.write(bytes, off, len); } else if (len < 65536) { riverMarshaller.write(Protocol.ID_START_BLOCK_MEDIUM); riverMarshaller.writeShort(len); riverMarshaller.write(bytes, off, len); } else { riverMarshaller.write(Protocol.ID_START_BLOCK_LARGE); riverMarshaller.writeInt(len); riverMarshaller.write(bytes, off, len); } } else { System.arraycopy(bytes, off, buffer, position, len); this.position = position + len; } }
public void write(final byte[] bytes, final int off, final int len) throws IOException { if (len < 1) { return; } final int bl = buffer.length; final int position = this.position; if (len > bl - position || len > bl >> 1) { flush(); if (len < 256) { riverMarshaller.write(Protocol.ID_START_BLOCK_SMALL); riverMarshaller.writeByte(len); riverMarshaller.write(bytes, off, len); } else if (len < 65536) { riverMarshaller.write(Protocol.ID_START_BLOCK_MEDIUM); riverMarshaller.writeShort(len); riverMarshaller.write(bytes, off, len); } else { riverMarshaller.write(Protocol.ID_START_BLOCK_LARGE); riverMarshaller.writeInt(len); riverMarshaller.write(bytes, off, len); } } else { System.arraycopy(bytes, off, buffer, position, len); this.position = position + len; } }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } else { write(ID_REPEAT_CLASS_FAR); writeInt(i); } return true; } return false; }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { if (configuredVersion >= 2) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } return true; } write(ID_REPEAT_CLASS_FAR); writeInt(i); return true; } return false; }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } else { write(ID_REPEAT_CLASS_FAR); writeInt(i); } return true; } return false; }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } else { write(ID_REPEAT_CLASS_FAR); writeInt(i); } return true; } return false; }
protected boolean writeKnownClass(final Class<?> objClass) throws IOException { final int configuredVersion = this.configuredVersion; int i = getBasicClasses(configuredVersion).get(objClass, -1); if (i != -1) { write(i); return true; } i = classCache.get(objClass, -1); if (i != -1) { final int diff = i - classSeq; if (diff >= -256) { write(ID_REPEAT_CLASS_NEAR); write(diff); } else if (diff >= -65536) { write(ID_REPEAT_CLASS_NEARISH); writeShort(diff); } else { write(ID_REPEAT_CLASS_FAR); writeInt(i); } return true; } return false; }