public int read() throws IOException { if (unreadInMemoryDataExists()) { return (inMemoryData[inMemoryDataPointer++] & 0xff); } else { return streamData.read(); } }
/** * Returns a BinaryData object (which is a stream) that encodes the given message * just like {@link #toHawkularFormat(BasicMessage)} does but also packages the given * input stream as extra data with the JSON message. * * The returned object can be used to deserialize the msg and extra data via {@link #deserialize(InputStream)}. * * @param msg the message object that will be serialized into JSON * @param extraData the extra data to be packages with the given message * @return an object that can be used by other Hawkular endpoints to deserialize the message. */ public static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData) { String msgJson = toHawkularFormat(msg); return new BinaryData(msgJson.getBytes(), extraData); }
throw new IllegalArgumentException("Stream cannot be converted to JSON object of type [" + clazz + "]", e); return new BasicMessageWithExtraData<T>(obj, new BinaryData(remainder, in));
throw new IllegalArgumentException("Stream cannot be converted to JSON object of type [" + clazz + "]", e); return new BasicMessageWithExtraData<T>(obj, new BinaryData(remainder, in));
public int read(byte[] b) throws IOException { if (unreadInMemoryDataExists()) { return super.read(b); // the superclass implementation is all we need } else { return this.streamData.read(b); // delegate directly to the stream } }
BinaryData messagePlusBinaryData = new BinaryData(basicMessage.toJSON().getBytes(), inputStream);
public long skip(long n) throws IOException { if (unreadInMemoryDataExists()) { return super.skip(n); // the superclass implementation is all we need } else { return this.streamData.skip(n); // delegate directly to the stream } }
BinaryData messagePlusBinaryData = new BinaryData(basicMessage.toJSON().getBytes(), inputStream);
public int read(byte[] b, int off, int len) throws IOException { if (unreadInMemoryDataExists()) { return super.read(b, off, len); // the superclass implementation is all we need } else { return this.streamData.read(b, off, len); // delegate directly to the stream } }