public short readShort() throws IOException { if (remaining < 2) { return (short) (readUnsignedByte() << 8 | readUnsignedByte()); } else { remaining -= 2; return riverUnmarshaller.readShort(); } }
public int readInt() throws IOException { if (remaining < 4) { return readUnsignedByte() << 24 | readUnsignedByte() << 16 | readUnsignedByte() << 8 | readUnsignedByte(); } else { remaining -= 4; return riverUnmarshaller.readInt(); } }
public Class<?> getNearestType() { Class<?> type = getType(); return type == null ? getSuperClassDescriptor().getNearestType() : type; }
private void doWriteObject(final Object obj, final boolean unshared) throws IOException { flush(); riverMarshaller.doWriteObject(obj, unshared); flush(); }
public char readChar() throws IOException { if (remaining < 2) { return (char) (readUnsignedByte() << 8 | readUnsignedByte()); } else { remaining -= 2; return riverUnmarshaller.readChar(); } }
public int readUnsignedShort() throws IOException { if (remaining < 2) { return readUnsignedByte() << 8 | readUnsignedByte(); } else { remaining -= 2; return riverUnmarshaller.readUnsignedShort(); } }
public long readLong() throws IOException { if (remaining < 8) { return (long) readUnsignedByte() << 56L | (long) readUnsignedByte() << 48L | (long) readUnsignedByte() << 40L | (long) readUnsignedByte() << 32L | (long) readUnsignedByte() << 24L | (long) readUnsignedByte() << 16L | (long) readUnsignedByte() << 8L | (long) readUnsignedByte(); } else { remaining -= 8; return riverUnmarshaller.readLong(); } }
public RiverObjectOutputStream run() throws IOException { return new RiverObjectOutputStream(getBlockMarshaller(), RiverMarshaller.this); } };
public int read() throws IOException { while (remaining == 0) { final int v = riverUnmarshaller.read(); if (v == -1) { return -1; } readBlockHeader(v); } if (remaining == -1) { return -1; } remaining--; return riverUnmarshaller.read(); }
protected void writeClassClass(final Class<?> classObj) throws IOException { write(ID_CLASS_CLASS); writeClass(classObj); // not cached }
protected void writeExternalizerClass(final Class<?> objClass, final Externalizer externalizer) throws IOException { if (! writeKnownClass(objClass)) { writeNewExternalizerClass(objClass, externalizer); } }
protected void writeSerializableClass(final Class<?> objClass) throws IOException { if (! writeKnownClass(objClass)) { writeNewSerializableClass(objClass); } }
protected void writeProxyClass(final Class<?> objClass) throws IOException { if (! writeKnownClass(objClass)) { writeNewProxyClass(objClass); } }
public int readUnsignedByte() throws IOException { while (remaining == 0) { readBlockHeader(riverUnmarshaller.readUnsignedByte()); } if (remaining == -1) { throw new EOFException(); } remaining--; return riverUnmarshaller.readUnsignedByte(); }
public ClassDescriptor getSuperClassDescriptor() { return check(result).getSuperClassDescriptor(); }
public SerializableClass getSerializableClass() { return check(result).getSerializableClass(); }
public void defaultWriteObject() throws IOException { if (! compareAndSetState(UNWRITTEN_FIELDS, ON)) { throw new NotActiveException("writeFields() may only be called when the fields have not yet been written"); } try { marshaller.doWriteFields(serializableClass, current); } finally { putField = null; serializableClass = null; current = null; } }
public void write(final int v) throws IOException { final byte[] buffer = this.buffer; final int remaining = buffer.length - position; if (remaining == 0) { flush(); buffer[0] = (byte) v; position = 1; } else { buffer[position++] = (byte) v; } }