private static void buildFieldFromInputStream(Pipe pipe, final int loc, InputStream inputStream, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(inputStream, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
private static void buildFieldFromDataInput(Pipe pipe, final int loc, DataInput dataInput, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(dataInput, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
private static void buildFieldFromInputStream(Pipe pipe, final int loc, InputStream inputStream, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(inputStream, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
private static void buildFieldFromDataInput(Pipe pipe, final int loc, DataInput dataInput, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(dataInput, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
private static void buildFieldFromDataInput(Pipe pipe, final int loc, DataInput dataInput, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(dataInput, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
private static void buildFieldFromInputStream(Pipe pipe, final int loc, InputStream inputStream, final int byteCount, int position, int byteMask, byte[] buffer, int sizeOfBlobRing, final int startPosition, int remaining, int size) throws IOException { while ( (remaining>0) && (size=Pipe.safeRead(inputStream, position&byteMask, buffer, sizeOfBlobRing, remaining))>=0 ) { if (size>0) { remaining -= size; position += size; } else { Thread.yield(); } } PipeWriter.writeSpecialBytesPosAndLen(pipe, loc, byteCount, startPosition); }
public static <T extends MessageSchema<T>> int closeHighLevelField(DataOutputBlobWriter<T> writer, int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(writer); //Appendables.appendUTF8(System.err, writer.byteBuffer, writer.startPosition, len, writer.byteMask); PipeWriter.writeSpecialBytesPosAndLen(writer.backingPipe, targetFieldLoc, len, writer.startPosition); writer.backingPipe.closeBlobFieldWrite(); //Appendables.appendUTF8(System.out, writer.getPipe().blobRing, writer.startPosition, len, writer.getPipe().blobMask); return len; }
public int closeHighLevelField(int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(); PipeWriter.writeSpecialBytesPosAndLen(p, targetFieldLoc, len, startPosition); p.closeBlobFieldWrite(); return len; }
public static <T extends MessageSchema<T>> int closeHighLevelField(DataOutputBlobWriter<T> writer, int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(writer); //Appendables.appendUTF8(System.err, writer.byteBuffer, writer.startPosition, len, writer.byteMask); PipeWriter.writeSpecialBytesPosAndLen(writer.backingPipe, targetFieldLoc, len, writer.startPosition); writer.backingPipe.closeBlobFieldWrite(); //Appendables.appendUTF8(System.out, writer.getPipe().blobRing, writer.startPosition, len, writer.getPipe().blobMask); return len; }
public int closeHighLevelField(int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(); PipeWriter.writeSpecialBytesPosAndLen(p, targetFieldLoc, len, startPosition); p.closeBlobFieldWrite(); return len; }
public static <T extends MessageSchema<T>> int closeHighLevelField(DataOutputBlobWriter<T> writer, int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(writer); //Appendables.appendUTF8(System.err, writer.byteBuffer, writer.startPosition, len, writer.byteMask); PipeWriter.writeSpecialBytesPosAndLen(writer.backingPipe, targetFieldLoc, len, writer.startPosition); writer.backingPipe.closeBlobFieldWrite(); //Appendables.appendUTF8(System.out, writer.getPipe().blobRing, writer.startPosition, len, writer.getPipe().blobMask); return len; }
public int closeHighLevelField(int targetFieldLoc) { //this method will also validate the length was in bound and throw unsupported operation if the pipe was not large enough //instead of fail fast as soon as one field goes over we wait to the end and only check once. int len = length(); PipeWriter.writeSpecialBytesPosAndLen(p, targetFieldLoc, len, startPosition); p.closeBlobFieldWrite(); return len; }
private static void finishWriteBytesAlreadyStarted(Pipe pipe, int loc, int length) { int p = Pipe.getWorkingBlobHeadPosition( pipe); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); Pipe.validateVarLength(pipe, length); writeSpecialBytesPosAndLen(pipe, loc, length, p); }
private static void finishWriteBytesAlreadyStarted(Pipe pipe, int loc, int length) { int p = Pipe.getWorkingBlobHeadPosition( pipe); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); Pipe.validateVarLength(pipe, length); writeSpecialBytesPosAndLen(pipe, loc, length, p); }
private static void finishWriteBytesAlreadyStarted(Pipe pipe, int loc, int length) { int p = Pipe.getWorkingBlobHeadPosition( pipe); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); Pipe.validateVarLength(pipe, length); writeSpecialBytesPosAndLen(pipe, loc, length, p); }
public static boolean requestConnect(CharSequence url, int conFlags, byte[] willTopic, int willTopicIdx, int willTopicLength, int willTopicMask, byte[] willMessageBytes, int willMessageBytesIdx, int willMessageBytesLength, int willMessageBytesMask, byte[] username, byte[] passwordBytes, Pipe<MQTTConnectionInSchema> toBroker, byte[] clientId, int ttlSec) { if (PipeWriter.tryWriteFragment(toBroker, MQTTConnectionInSchema.MSG_CONNECT_2)) { PipeWriter.writeASCII(toBroker, MQTTConnectionInSchema.MSG_CONNECT_2_FIELD_HOST_401, url); //this is the high level API however we are writing bytes to to the end of the unstructured buffer. final int bytePos = Pipe.getWorkingBlobHeadPosition(toBroker); byte[] byteBuffer = Pipe.blob(toBroker); int byteMask = Pipe.blobMask(toBroker); int len = buildConnectPacket(bytePos, byteBuffer, byteMask, ttlSec, conFlags, clientId, 0 , clientId.length, 0xFFFF, willTopic, willTopicIdx , willTopicLength, willTopicMask, willMessageBytes, willMessageBytesIdx, willMessageBytesLength, willMessageBytesMask, username, 0, username.length, 0xFFFF, //TODO: add rest of fields passwordBytes, 0, passwordBytes.length, 0xFFFF);//TODO: add rest of fields assert(len>0); PipeWriter.writeSpecialBytesPosAndLen(toBroker, MQTTConnectionInSchema.MSG_CONNECT_2_FIELD_PACKETDATA_300, len, bytePos); PipeWriter.publishWrites(toBroker); return true; } else { return false; } }
PipeWriter.writeSpecialBytesPosAndLen(msgCommandChannel.messagePubSub, MessagePubSub.MSG_PUBLISH_103_FIELD_PAYLOAD_3, -1, 0); PipeWriter.publishWrites(msgCommandChannel.messagePubSub);
PipeWriter.writeSpecialBytesPosAndLen(msgCommandChannel.messagePubSub, MessagePubSub.MSG_PUBLISH_103_FIELD_PAYLOAD_3, -1, 0); PipeWriter.publishWrites(msgCommandChannel.messagePubSub);
topic, topicIdx, topicLength, topicMask, payload, payloadIdx, payloadLength, payloadMask, localPacketId); PipeWriter.writeSpecialBytesPosAndLen(toBroker, MQTTConnectionInSchema.MSG_PUBLISH_1_FIELD_PACKETDATA_300, len, bytePos);
PipeWriter.writeSpecialBytesPosAndLen(msgCommandChannel.messagePubSub, MessagePubSub.MSG_PUBLISH_103_FIELD_PAYLOAD_3, -1, 0); PipeWriter.publishWrites(msgCommandChannel.messagePubSub);