/** * Copies bytes from specified pipe to target pipe * @param sourcePipe to copy from * @param targetPipe to copy to * @param sourceLOC location of bytes to copy * @param targetLOC location to put bytes * @return length of copied bytes */ public static int copyBytes(final Pipe sourcePipe, final Pipe targetPipe, int sourceLOC, int targetLOC) { assert(LOCUtil.isLocOfAnyType(sourceLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(sourceLOC); assert(LOCUtil.isLocOfAnyType(targetLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(targetLOC); //alternate implementation DataInputBlobReader src = PipeReader.inputStream(sourcePipe, sourceLOC); DataOutputBlobWriter tgt = PipeWriter.outputStream(targetPipe); DataOutputBlobWriter.openField(tgt); int len = src.available(); tgt.writeStream(src, len); if (src.isStructured) { src.readFromEndInto(tgt); } DataOutputBlobWriter.closeHighLevelField(tgt, targetLOC); return len; }
/** * Copies bytes from specified pipe to target pipe * @param sourcePipe to copy from * @param targetPipe to copy to * @param sourceLOC location of bytes to copy * @param targetLOC location to put bytes * @return length of copied bytes */ public static int copyBytes(final Pipe sourcePipe, final Pipe targetPipe, int sourceLOC, int targetLOC) { assert(LOCUtil.isLocOfAnyType(sourceLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(sourceLOC); assert(LOCUtil.isLocOfAnyType(targetLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(targetLOC); //alternate implementation DataInputBlobReader src = PipeReader.inputStream(sourcePipe, sourceLOC); DataOutputBlobWriter tgt = PipeWriter.outputStream(targetPipe); DataOutputBlobWriter.openField(tgt); int len = src.available(); tgt.writeStream(src, len); if (src.isStructured) { src.readFromEndInto(tgt); } DataOutputBlobWriter.closeHighLevelField(tgt, targetLOC); return len; }
/** * Copies bytes from specified pipe to target pipe * @param sourcePipe to copy from * @param targetPipe to copy to * @param sourceLOC location of bytes to copy * @param targetLOC location to put bytes * @return length of copied bytes */ public static int copyBytes(final Pipe sourcePipe, final Pipe targetPipe, int sourceLOC, int targetLOC) { assert(LOCUtil.isLocOfAnyType(sourceLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(sourceLOC); assert(LOCUtil.isLocOfAnyType(targetLOC, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(targetLOC); //alternate implementation DataInputBlobReader src = PipeReader.inputStream(sourcePipe, sourceLOC); DataOutputBlobWriter tgt = PipeWriter.outputStream(targetPipe); DataOutputBlobWriter.openField(tgt); int len = src.available(); tgt.writeStream(src, len); if (src.isStructured) { src.readFromEndInto(tgt); } DataOutputBlobWriter.closeHighLevelField(tgt, targetLOC); return len; }
((DataInputBlobReader<?>)inStream).readFromEndInto((DataOutputBlobWriter<?>) outStream); DataOutputBlobWriter.setStructType((DataOutputBlobWriter<?>)outStream,-1); //clear out copied type
peekInputStream.readFromEndInto((DataOutputBlobWriter)w); //NOTE: this moves struct across.
boolean copiedIdx = ((DataInputBlobReader)payload).readFromEndInto(writer); //ciopy index and struct int type = DataInputBlobReader.getStructType((DataInputBlobReader)payload); DataOutputBlobWriter.commitBackData(writer, type);
inputStream.readFromEndInto(outputStream); inputStream.readFromEndInto(outputStream); inputStream.readFromEndInto(outputStream);
inputStream.readFromEndInto(outputStream); inputStream.readFromEndInto(outputStream); //TODO: only needed on first block
str.writePackedInt(fullIndexSizeInBytes); if (fullIndexSizeInBytes>0) { data.readFromEndInto(str); str.writePackedInt(DataInputBlobReader.getStructType(data));