@Override public int closeHighLevelField(int targetFieldLoc) { return closeHighLevelField(this, targetFieldLoc); }
@Override public int closeHighLevelField(int targetFieldLoc) { return closeHighLevelField(this, targetFieldLoc); }
@Override public int closeHighLevelField(int targetFieldLoc) { return closeHighLevelField(this, targetFieldLoc); }
@Override public void stringEnd() { if (activeFieldLoc>0) { if (!mapper.isNumeric(activeFieldLoc)) { DataOutputBlobWriter<M> out = PipeWriter.outputStream(pipe); //this data looks correct. //byte[] byteArray = out.toByteArray(); //System.err.println(activeFieldLoc+" CAPTURED TEXT:"+new String(byteArray)); int len = DataOutputBlobWriter.closeHighLevelField(out, activeFieldLoc); } else { pipe.closeBlobFieldWrite(); // System.err.println("UNABLE TO PARSE NUMERIC:"+new String(out.toByteArray())); } activeFieldLoc = 0; } }
@Override public void stringEnd() { if (activeFieldLoc>0) { if (!mapper.isNumeric(activeFieldLoc)) { DataOutputBlobWriter<M> out = PipeWriter.outputStream(pipe); //this data looks correct. //byte[] byteArray = out.toByteArray(); //System.err.println(activeFieldLoc+" CAPTURED TEXT:"+new String(byteArray)); int len = DataOutputBlobWriter.closeHighLevelField(out, activeFieldLoc); } else { pipe.closeBlobFieldWrite(); // System.err.println("UNABLE TO PARSE NUMERIC:"+new String(out.toByteArray())); } activeFieldLoc = 0; } }
@Override public void stringEnd() { if (activeFieldLoc>0) { if (!mapper.isNumeric(activeFieldLoc)) { DataOutputBlobWriter<M> out = PipeWriter.outputStream(pipe); //this data looks correct. //byte[] byteArray = out.toByteArray(); //System.err.println(activeFieldLoc+" CAPTURED TEXT:"+new String(byteArray)); int len = DataOutputBlobWriter.closeHighLevelField(out, activeFieldLoc); } else { pipe.closeBlobFieldWrite(); // System.err.println("UNABLE TO PARSE NUMERIC:"+new String(out.toByteArray())); } activeFieldLoc = 0; } }
mcuWriter.writeShort(emcu.y[i]); DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_Y_104); mcuWriter.writeShort(emcu.cb[i]); DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_CB_204); mcuWriter.writeShort(emcu.cr[i]); DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_CR_304);
public void sendMCU(MCU emcu) { if (PipeWriter.tryWriteFragment(output, JPGSchema.MSG_MCUMESSAGE_4)) { DataOutputBlobWriter<JPGSchema> mcuWriter = PipeWriter.outputStream(output); DataOutputBlobWriter.openField(mcuWriter); for (int i = 0; i < 64; ++i) { mcuWriter.writeShort(emcu.y[i]); } DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_Y_104); DataOutputBlobWriter.openField(mcuWriter); for (int i = 0; i < 64; ++i) { mcuWriter.writeShort(emcu.cb[i]); } DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_CB_204); DataOutputBlobWriter.openField(mcuWriter); for (int i = 0; i < 64; ++i) { mcuWriter.writeShort(emcu.cr[i]); } DataOutputBlobWriter.closeHighLevelField(mcuWriter, JPGSchema.MSG_MCUMESSAGE_4_FIELD_CR_304); PipeWriter.publishWrites(output); } else { logger.error("YCbCrToRGB requesting shutdown"); requestShutdown(); } }
private void publishConnectionFeedback() { if (connectionFeedbackTopic != null) { PipeWriter.presumeWriteFragment(output, IngressMessages.MSG_PUBLISH_103); PipeWriter.writeUTF8(output, IngressMessages.MSG_PUBLISH_103_FIELD_TOPIC_1, connectionFeedbackTopic); DataOutputBlobWriter<IngressMessages> stream = PipeWriter.outputStream(output); DataOutputBlobWriter.openField(stream); stream.write(connectResult); stream.closeHighLevelField(IngressMessages.MSG_PUBLISH_103_FIELD_PAYLOAD_3); PipeWriter.publishWrites(output); } } }
output.closeHighLevelField(MessagePubSub.MSG_SUBSCRIBE_100_FIELD_TOPIC_1);
/** * * @param blockId long arg used in PipeWriter.writeLong * @param w Writable arg used to write(stream) * @return if (PipeWriter.tryWriteFragment(target, PersistedBlobStoreProducerSchema.MSG_BLOCK_1)) true else false */ public boolean store(long blockId, Writable w) { if (PipeWriter.tryWriteFragment(target, PersistedBlobStoreProducerSchema.MSG_BLOCK_1)) { PipeWriter.writeLong(target,PersistedBlobStoreProducerSchema.MSG_BLOCK_1_FIELD_BLOCKID_3, blockId); DataOutputBlobWriter<PersistedBlobStoreProducerSchema> stream = PipeWriter.outputStream(target); DataOutputBlobWriter.openField(stream); w.write(stream); DataOutputBlobWriter.closeHighLevelField(stream, PersistedBlobStoreProducerSchema.MSG_BLOCK_1_FIELD_BYTEARRAY_2); PipeWriter.publishWrites(target); return true; } else { return false; } }
output.closeHighLevelField(MessagePubSub.MSG_UNSUBSCRIBE_101_FIELD_TOPIC_1);
output.closeHighLevelField(MessagePubSub.MSG_SUBSCRIBE_100_FIELD_TOPIC_1);
/** * A method used to unsubscribe from a specific topic and listener * @param topic CharSequence arg used in output.append * @param listener PubSubMethodListenerBase arg used in PipeWriter.writeInt * @return true if msgCommandChannel.goPipe == null || PipeWriter.hasRoomForWrite(msgCommandChannel.goPipe) <p> else false */ public boolean unsubscribe(CharSequence topic, PubSubMethodListenerBase listener) { assert((0 != (msgCommandChannel.initFeatures & MsgCommandChannel.DYNAMIC_MESSAGING))) : "CommandChannel must be created with DYNAMIC_MESSAGING flag"; if (msgCommandChannel.goHasRoom() && PipeWriter.tryWriteFragment(msgCommandChannel.messagePubSub, MessagePubSub.MSG_UNSUBSCRIBE_101)) { PipeWriter.writeInt(msgCommandChannel.messagePubSub, MessagePubSub.MSG_SUBSCRIBE_100_FIELD_SUBSCRIBERIDENTITYHASH_4, System.identityHashCode(listener)); //OLD PipeWriter.writeUTF8(messagePubSub, MessagePubSub.MSG_UNSUBSCRIBE_101_FIELD_TOPIC_1, topic); DataOutputBlobWriter<MessagePubSub> output = PipeWriter.outputStream(msgCommandChannel.messagePubSub); output.openField(); output.append(topic); MsgCommandChannel.publicTrackedTopicSuffix(msgCommandChannel, output); output.closeHighLevelField(MessagePubSub.MSG_UNSUBSCRIBE_101_FIELD_TOPIC_1); PipeWriter.publishWrites(msgCommandChannel.messagePubSub); msgCommandChannel.builder.releasePubSubTraffic(1, msgCommandChannel); return true; } return false; }
private void publishConnect(Pipe<MQTTClientRequestSchema> output) { PipeWriter.presumeWriteFragment(output, MQTTClientRequestSchema.MSG_CONNECT_1); PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_KEEPALIVESEC_28, keepAliveSeconds); PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_FLAGS_29, flags); PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_CLIENTID_30, (CharSequence) clientId); PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLTOPIC_31, (CharSequence) lastWillTopic); DataOutputBlobWriter<MQTTClientRequestSchema> writer = PipeWriter.outputStream(output); DataOutputBlobWriter.openField(writer); if(null!= lastWillPayload) { lastWillPayload.write((MQTTWriter)writer); } DataOutputBlobWriter.closeHighLevelField(writer, MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLPAYLOAD_32); PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_USER_33, (CharSequence) user); PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_PASS_34, (CharSequence) pass); PipeWriter.publishWrites(output); }
/** * 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; }
private void streamingRequest(Pipe<ClientHTTPRequestSchema> pipe, int httpRequestResponseId) { PipeWriter.presumeWriteFragment(pipe, ClientHTTPRequestSchema.MSG_GET_200); assert(httpRequestResponseId>=0); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_SESSION_10, httpRequestResponseId); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, port); int hostId = ClientCoordinator.registerDomain(host); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, hostId); PipeWriter.writeLong(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, -1 ); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_DESTINATION_11, httpRequestResponseId); PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_PATH_3, path); DataOutputBlobWriter<ClientHTTPRequestSchema> stream = PipeWriter.outputStream(pipe); DataOutputBlobWriter.openField(stream); myAuth.addHeaders(stream, "GET").append("\r\n"); //myAuth.addHeaders(System.out, "GET"); DataOutputBlobWriter.closeHighLevelField(stream, ClientHTTPRequestSchema.MSG_GET_200_FIELD_HEADERS_7); PipeWriter.publishWrites(pipe); }
DataOutputBlobWriter.openField(stream); writeHeaders(ck, cs, stream); DataOutputBlobWriter.closeHighLevelField(stream, ClientHTTPRequestSchema.MSG_POST_201_FIELD_HEADERS_7);