public static <T extends MessageSchema<T>> int getStructType(DataOutputBlobWriter<T> writer) { final int base = writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe); return ( ( ( writer.byteBuffer[writer.byteMask & base]) << 24) | ( (0xFF & writer.byteBuffer[writer.byteMask & (base+1)]) << 16) | ( (0xFF & writer.byteBuffer[writer.byteMask & (base+2)]) << 8) | (0xFF & writer.byteBuffer[writer.byteMask & (base+3)]) ); }
private static <T extends MessageSchema<T>> int computeBackDataPos(DataOutputBlobWriter<T> writer, int pos) { return writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)-(4*(pos+1)); }
public static int getStructType(DataInputBlobReader<?> reader) { //must return -1 when structures are not used, in that case we may have //valid data beyond the body of this payload. so we can not fetch the value. return (!reader.isStructured) ? -1 : StructRegistry.IS_STRUCT_BIT | bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe)), reader.byteMask, reader.backing); }
public static int readFromLastInt(DataInputBlobReader<?> reader, int pos) { assert(pos>=0) : "there is no data found at the end"; //logger.info("readFromEndLastInt pos {} ",position); return bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe))-(4*(pos+1)), reader.byteMask, reader.backing); }
public static int readFromLastInt(DataInputBlobReader<?> reader, int pos) { assert(pos>=0) : "there is no data found at the end"; //logger.info("readFromEndLastInt pos {} ",position); return bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe))-(4*(pos+1)), reader.byteMask, reader.backing); }
public static <T extends MessageSchema<T>> void writeToEndFrom(DataOutputBlobWriter<T> writer, int sizeInBytes, DataInputBlobReader<RawDataSchema> reader) { DataInputBlobReader.read(reader, writer.byteBuffer, writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)-sizeInBytes, sizeInBytes, writer.byteMask); }
public static <T extends MessageSchema<T>> void writeToEndFrom(DataOutputBlobWriter<T> writer, int sizeInBytes, DataInputBlobReader<RawDataSchema> reader) { DataInputBlobReader.read(reader, writer.byteBuffer, writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)-sizeInBytes, sizeInBytes, writer.byteMask); }
public static int getStructType(DataInputBlobReader<?> reader) { //must return -1 when structures are not used, in that case we may have //valid data beyond the body of this payload. so we can not fetch the value. return (!reader.isStructured) ? -1 : StructRegistry.IS_STRUCT_BIT | bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe)), reader.byteMask, reader.backing); }
public static <T extends MessageSchema<T>> void writeToEndFrom(DataOutputBlobWriter<T> writer, int sizeInBytes, DataInputBlobReader<RawDataSchema> reader) { DataInputBlobReader.read(reader, writer.byteBuffer, writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)-sizeInBytes, sizeInBytes, writer.byteMask); }
public static int getStructType(DataInputBlobReader<?> reader) { //must return -1 when structures are not used, in that case we may have //valid data beyond the body of this payload. so we can not fetch the value. return (!reader.isStructured) ? -1 : StructRegistry.IS_STRUCT_BIT | bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe)), reader.byteMask, reader.backing); }
public static int readFromLastInt(DataInputBlobReader<?> reader, int pos) { assert(pos>=0) : "there is no data found at the end"; //logger.info("readFromEndLastInt pos {} ",position); return bigEndianInt((reader.bytesLowBound + Pipe.blobIndexBasePosition(reader.pipe))-(4*(pos+1)), reader.byteMask, reader.backing); }
public static <T extends MessageSchema<T>> int getStructType(DataOutputBlobWriter<T> writer) { return peekInt(writer, writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)); }
public static <T extends MessageSchema<T>> boolean structTypeValidation(DataOutputBlobWriter<T> writer, int value) { int old = getStructType(writer); if (value!=old) { if (old<=0) { writer.structuredWithIndexData = true; int base2 = writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe); write32(writer.byteBuffer, writer.byteMask, base2, value); } else { throw new UnsupportedOperationException("Type mismatch found "+old+" expected "+value); } } return true; }
public static <T extends MessageSchema<T>> boolean structTypeValidation(DataOutputBlobWriter<T> writer, int value) { int old = getStructType(writer); if (value!=old) { if (old<=0) { writer.structuredWithIndexData = true; int base2 = writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe); write32(writer.byteBuffer, writer.byteMask, base2, value); } else { throw new UnsupportedOperationException("Type mismatch found "+old+" expected "+value); } } return true; }
public static <T extends MessageSchema<T>> boolean structTypeValidation(DataOutputBlobWriter<T> writer, int value) { int old = getStructType(writer); if (value!=old) { if (old<=0) { writer.structuredWithIndexData = true; int base2 = writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe); write32(writer.byteBuffer, writer.byteMask, base2, value); } else { throw new UnsupportedOperationException("Type mismatch found "+old+" expected "+value); } } return true; }
public static <T extends MessageSchema<T>> DataOutputBlobWriter<T> openFieldAtPosition(final DataOutputBlobWriter<T> writer, int workingBlobHeadPosition) { assert(workingBlobHeadPosition>=0) : "working head position must not be negative"; writer.backingPipe.openBlobFieldWrite(); //NOTE: this method works with both high and low APIs. writer.startPosition = writer.activePosition = (writer.byteMask & workingBlobHeadPosition); //without any index we can write all the way up to maxVarLen; writer.lastPosition = writer.startPosition + writer.backingPipe.maxVarLen; //with an index we are limited because room is saved for type data lookup. writer.backPosition = writer.startPosition + Pipe.blobIndexBasePosition(writer.backingPipe); //this is turned on when callers begin to add index data writer.structuredWithIndexData = false; DataOutputBlobWriter.setStructType(writer, -1);//clear any previous type return writer; }
public static <T extends MessageSchema<T>> void setIntBackData(DataOutputBlobWriter<T> writer, int value, int pos) { assert(value<=writer.position()) : "wrote "+value+" but all the data is only "+writer.position(); assert(pos>=0) : "Can not write beyond the end. Index values must be zero or positive"; write32(writer.byteBuffer, writer.byteMask, writer.startPosition+Pipe.blobIndexBasePosition(writer.backingPipe)-(4*(pos+1)), value); }
private boolean confirmDataDoesNotWriteOverIndex(long fieldId) { return channelWriter.position()< (Pipe.blobIndexBasePosition(channelWriter.backingPipe)-(4*Pipe.structRegistry(channelWriter.backingPipe) .totalSizeOfIndexes((int)(fieldId>>StructRegistry.STRUCT_OFFSET)))); }
private boolean confirmDataDoesNotWriteOverIndex(long fieldId) { return channelWriter.position()< (Pipe.blobIndexBasePosition(channelWriter.backingPipe)-(4*Pipe.structRegistry(channelWriter.backingPipe) .totalSizeOfIndexes((int)(fieldId>>StructRegistry.STRUCT_OFFSET)))); }
private boolean confirmDataDoesNotWriteOverIndex(long fieldId) { return channelWriter.position()< (Pipe.blobIndexBasePosition(channelWriter.backingPipe)-(4*Pipe.structRegistry(channelWriter.backingPipe) .totalSizeOfIndexes((int)(fieldId>>StructRegistry.STRUCT_OFFSET)))); }