@Override public void position(int position) { position(this, position); }
@Override public void position(int position) { position(this, position); }
@Override public void position(int position) { position(this, position); }
public static int bytesRemaining(DataInputBlobReader<?> that) { return that.length - that.position(); }
public static int bytesRemaining(DataInputBlobReader<?> that) { return that.length - that.position(); }
@Deprecated public void setPositionBytesFromStart(int byteIndexFromStart) { position(this, byteIndexFromStart); }
@Deprecated public void setPositionBytesFromStart(int byteIndexFromStart) { position(this, byteIndexFromStart); }
@Deprecated public void setPositionBytesFromStart(int byteIndexFromStart) { position(this, byteIndexFromStart); }
public final ChannelReader readPayload() { DataInputBlobReader.position(channelReader, DataInputBlobReader.readFromLastInt(channelReader, StructuredReader.PAYLOAD_INDEX_LOCATION)); return channelReader; }
/** * set to a position for general reading unless index position is not provided */ public ChannelReader read(long fieldId) { final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); return channelReader; } else { return null; } }
public final ChannelReader readPayload() { DataInputBlobReader.position(channelReader, DataInputBlobReader.readFromLastInt(channelReader, StructuredReader.PAYLOAD_INDEX_LOCATION)); return channelReader; }
/** * set to a position for general reading unless index position is not provided */ public ChannelReader read(long fieldId) { final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); return channelReader; } else { return null; } }
/** * set to a position for general reading unless index position is not provided */ public ChannelReader read(long fieldId) { final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); return channelReader; } else { return null; } }
public final ChannelReader readPayload() { DataInputBlobReader.position(channelReader, DataInputBlobReader.readFromLastInt(channelReader, StructuredReader.PAYLOAD_INDEX_LOCATION)); return channelReader; }
/** * Reads decimal as String and appends to target * @param id long field association showing where to read * @param target to append to * @return appended data */ public <A extends Appendable> A readDecimalAsText(long id, A target) { this.channelReader.position(this.channelReader .readFromEndLastInt(StructRegistry.FIELD_MASK & (int)id)); return channelReader.readDecimalAsText(target); }
/** * Reads decimal as String and appends to target * @param id long field association showing where to read * @param target to append to * @return appended data */ public <A extends Appendable> A readDecimalAsText(long id, A target) { this.channelReader.position(this.channelReader .readFromEndLastInt(StructRegistry.FIELD_MASK & (int)id)); return channelReader.readDecimalAsText(target); }
/** * Used by assertions to ensure that the cursor is set at the right position to read the given field. * This is important because it allows for checks at compile time so the lookup is removed from runtime. * @param association object for the field * @return true if the position of the channelReader is ready to read the field */ public boolean isPositionedToRead(Object association) { int indexOffset = indexOffset(association); final int index = channelReader.readFromEndLastInt(indexOffset); if (index>=0) { return index==channelReader.position(); } return false; }
public <T> boolean identityVisit(DataInputBlobReader<?> reader, T attachedObject, StructFieldVisitor<T> visitor) { int structId = DataInputBlobReader.getStructType(reader); int idx = StructRegistry.FIELD_MASK & (int)fieldLookupByIdentity(attachedObject, structId); if (idx>=0) { DataInputBlobReader.position(reader, DataInputBlobReader.readFromLastInt(reader, idx)); visitor.read((T)(fieldLocals[structId][idx]), reader); return true; } else { return false; } }
/** * Reads text at given field * @param fieldId to read from * @return text if data exists, else <code>null</code> */ public String readText(long fieldId) { assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); return channelReader.readUTF(); } else { return null; } }
/** * Reads text at given field * @param fieldId to read from * @return text if data exists, else <code>null</code> */ public String readText(long fieldId) { assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); return channelReader.readUTF(); } else { return null; } }