@Override public void readAdditionalData(DataInput in) throws ClassNotFoundException, IOException { try { this.uuidMSBs = in.readLong(); this.uuidLSBs = in.readLong(); memberWeight = (byte) (in.readByte() & 0xFF); } catch (EOFException e) { // some IDs do not have UUID or membership weight information } }
@Override public void readFields(DataInput in) throws IOException { short len = in.readShort(); if (len < THREE_LONGS) throw new IOException("Need at least " + THREE_LONGS + " bytes"); pathHash = in.readLong(); modTime = in.readLong(); length = in.readLong(); int extraBytes = len - THREE_LONGS; if (extraBytes > 0) { in.skipBytes(extraBytes); } } }
protected long readId(DataInput in, byte idType) throws IOException { switch (idType) { case ID_ONE_BYTE: return in.readByte() - Byte.MIN_VALUE; case ID_TWO_BYTES: return in.readShort() - Short.MIN_VALUE; case ID_FOUR_BYTES: return in.readInt() - Integer.MIN_VALUE; case ID_EIGHT_BYTES: return in.readLong() - Long.MIN_VALUE; default: throw new Error("Unknown idType " + idType); } }
@Deprecated static TransactionEventRecord fromDataInputV2(DataInput in) throws IOException { int header = in.readInt(); if (header != MAGIC_HEADER) { throw new IOException("Header " + Integer.toHexString(header) + " is not the required value: " + Integer.toHexString(MAGIC_HEADER)); } short type = in.readShort(); long transactionID = in.readLong(); long writeOrderID = in.readLong(); TransactionEventRecord entry = newRecordForType(type, transactionID, writeOrderID); entry.readFields(in); return entry; }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { name = DataSerializer.readString(in); length = in.readLong(); chunks = in.readInt(); created = in.readLong(); modified = in.readLong(); long high = in.readLong(); long low = in.readLong(); id = new UUID(high, low); possiblyRenamed = in.readBoolean(); }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); _isShrinked = in.readBoolean(); if (_isShrinked) { shrinkedLength = in.readLong(); } }
public void readFrom(DataInput in) throws Exception { type=Type.values()[in.readByte()]; // We can't use Util.readObject since it's size is limited to 2^15-1 try { short first = in.readShort(); if (first == -1) { object = Util.readGenericStreamable(in); } else { ByteBuffer bb = ByteBuffer.allocate(4); bb.putShort(first); bb.putShort(in.readShort()); int size = bb.getInt(0); byte[] bytes = new byte[size]; in.readFully(bytes, 0, size); object = Util.objectFromByteBuffer(bytes); } } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException("Exception encountered while serializing execution request", e); } request=in.readLong(); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); final byte extraFlags = in.readByte(); final boolean hasEventId = (extraFlags & HAS_EVENTID) != 0; if (hasEventId) { this.eventId = new EventID(); InternalDataSerializer.invokeFromData(this.eventId, in); boolean hasTailKey = in.readBoolean(); if (hasTailKey) { this.tailKey = in.readLong(); } } else { this.eventId = null; } this.key = DataSerializer.readObject(in); this.deserializationPolicy = (byte) (extraFlags & DESERIALIZATION_POLICY_MASK); if (hasDelta()) { this.deltaBytes = DataSerializer.readByteArray(in); } else { this.newValue = DataSerializer.readByteArray(in); if ((extraFlags & HAS_DELTA_WITH_FULL_VALUE) != 0) { this.deltaBytes = DataSerializer.readByteArray(in); } } }
@SuppressWarnings("unchecked") public BTreeNode<Key,Value> readPayload(DataInput is) throws IOException { BTreeNode<Key,Value> node = new BTreeNode<Key,Value>(index); int count = is.readShort(); node.keys = (Key[])new Object[count]; for (int i = 0; i < count; i++) { node.keys[i] = index.getKeyMarshaller().readPayload(is); } if( is.readBoolean() ) { node.children = new long[count+1]; for (int i = 0; i < count+1; i++) { node.children[i] = is.readLong(); } } else { node.values = (Value[])new Object[count]; for (int i = 0; i < count; i++) { node.values[i] = index.getValueMarshaller().readPayload(is); } node.next = is.readLong(); } return node; } }
/** * read the bits from an input stream * * @param dataIn * @throws IOException */ public void readFromStream(DataInput dataIn) throws IOException { length = dataIn.readByte(); if (length <= BYTE_SIZE) { bits = dataIn.readByte(); } else if (length <= SHORT_SIZE) { bits = dataIn.readShort(); } else if (length <= INT_SIZE) { bits = dataIn.readInt(); } else { bits = dataIn.readLong(); } } }
/** * @param buf Buffer to read from. * @return Read map. */ private Map<Integer, CacheState> readPartitionStates(DataInput buf) throws IOException { int caches = buf.readShort() & 0xFFFF; if (caches == 0) return Collections.emptyMap(); Map<Integer, CacheState> states = new HashMap<>(caches, 1.0f); for (int i = 0; i < caches; i++) { int cacheId = buf.readInt(); int parts = buf.readShort() & 0xFFFF; CacheState state = new CacheState(parts); for (int p = 0; p < parts; p++) { int partId = buf.readShort() & 0xFFFF; long size = buf.readLong(); long partCntr = buf.readLong(); state.addPartitionState(partId, size, partCntr); } states.put(cacheId, state); } return states; }
@Override public void readFields(DataInput in) throws IOException { version = in.readLong(); boolean hasMethods = in.readBoolean(); if (hasMethods) { int numMethods = in.readInt(); methods = new int[numMethods]; for (int i=0; i<numMethods; i++) { methods[i] = in.readInt(); } } }
/** * Reads UUID from input stream. This method is meant to be used by * implementations of {@link Externalizable} interface. * * @param in Input stream. * @return Read UUID. * @throws IOException If read failed. */ @Nullable public static UUID readUuid(DataInput in) throws IOException { // If UUID is not null. if (!in.readBoolean()) { long most = in.readLong(); long least = in.readLong(); return IgniteUuidCache.onIgniteUuidRead(new UUID(most, least)); } return null; }
@Override public void readFields(DataInput in) throws IOException { short len = in.readShort(); if (len < THREE_LONGS) throw new IOException("Need at least " + THREE_LONGS + " bytes"); pathHash = in.readLong(); modTime = in.readLong(); length = in.readLong(); int extraBytes = len - THREE_LONGS; if (extraBytes > 0) { in.skipBytes(extraBytes); } } }
@Override @InterfaceAudience.Private public void readFields(DataInput in) throws IOException { blockSize = in.readLong(); bytesPerChecksum = in.readInt(); writePacketSize = in.readInt(); replication = in.readShort(); fileBufferSize = in.readInt(); checksumType = WritableUtils.readEnum(in, DataChecksum.Type.class); storagepolicyId = in.readByte(); } }