/** {@inheritDoc} */ public int read(final byte[] b) throws IOException { return read(b, 0, b.length); }
/** {@inheritDoc} */ public void readFully(final byte[] b) throws IOException { readFully(b, 0, b.length); }
/** {@inheritDoc} */ public String readUTF() throws IOException { return UTFUtils.readUTFBytesByByteCount(this, readUnsignedShort()); }
/** {@inheritDoc} */ public short readShort() throws IOException { int position = this.position; int remaining = limit - position; if (remaining < 2) { return (short) (readUnsignedByteDirect() << 8 | readUnsignedByteDirect()); } else { final byte[] buffer = this.buffer; this.position = position + 2; return (short) (buffer[position] << 8 | (buffer[position + 1] & 0xff)); } }
/** {@inheritDoc} */ public int readInt() throws IOException { return readIntDirect(); }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
public long readLong() throws IOException { return readLongDirect(); }
if (this.bytes != null) { ByteArrayInputStream input = new ByteArrayInputStream(this.bytes); SimpleDataInput data = new SimpleDataInput(Marshalling.createByteInput(input)); int version = data.readInt(); Unmarshaller unmarshaller = context.createUnmarshaller(version); try {
/** * {@inheritDoc} * @see org.wildfly.clustering.marshalling.spi.MarshalledValue#get(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public synchronized T get(MarshallingContext context) throws IOException, ClassNotFoundException { if (this.object == null) { this.context = context; if (this.bytes != null) { ByteArrayInputStream input = new ByteArrayInputStream(this.bytes); ClassLoader loader = setThreadContextClassLoader(this.context.getClassLoader()); try (SimpleDataInput data = new SimpleDataInput(Marshalling.createByteInput(input))) { int version = IndexSerializer.VARIABLE.readInt(data); try (Unmarshaller unmarshaller = context.createUnmarshaller(version)) { unmarshaller.start(data); this.object = (T) unmarshaller.readObject(); unmarshaller.finish(); this.bytes = null; // Free up memory } } finally { setThreadContextClassLoader(loader); } } } return this.object; }
public int readInt() throws IOException { return input.readInt(); }
/** {@inheritDoc} */ public int readUnsignedShort() throws IOException { int position = this.position; int remaining = limit - position; if (remaining < 2) { return readUnsignedByteDirect() << 8 | readUnsignedByteDirect(); } else { final byte[] buffer = this.buffer; this.position = position + 2; return (buffer[position] & 0xff) << 8 | (buffer[position + 1] & 0xff); } }
/** {@inheritDoc} */ protected long readLongDirect() throws IOException { return (long) readIntDirect() << 32L | (long) readIntDirect() & 0xffffffffL; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public double readDouble() throws IOException { return Double.longBitsToDouble(readLongDirect()); }
try { inputStream = FISAction.open(file); SimpleDataInput input = new SimpleDataInput(Marshalling.createByteInput(inputStream)); int version = input.readInt(); MarshallingConfiguration config = this.passivationManager.getMarshallingConfiguration(version); Unmarshaller unmarshaller = this.marshallerFactory.createUnmarshaller(config);
public SimpleByteDataInput(final InputStream inputStream) { this.input = new SimpleDataInput(Marshalling.createByteInput(inputStream)); }
public int readInt() throws IOException { return input.readInt(); }
/** {@inheritDoc} */ public int read(final byte[] b) throws IOException { return read(b, 0, b.length); }
/** {@inheritDoc} */ public void readFully(final byte[] b) throws IOException { readFully(b, 0, b.length); }
public int readUnsignedShort() throws IOException { return input.readUnsignedShort(); }