skorotkov commented on code in PR #11518: URL: https://github.com/apache/ignite/pull/11518#discussion_r1810616427
########## modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java: ########## @@ -1880,6 +1892,72 @@ public void writeFieldIdNoSchemaUpdate(int fieldId) { fieldCnt++; } + /** + * Write byte array from the InputStream with the specified length. + * + * @param in InputStream. + * @param len Length of data in the stream. + * @return Number of bytes written. + */ + public int writeByteArrayFromInputStream(InputStream in, int len) throws IOException { + out.unsafeEnsure(1 + 4 + len); + + return doWriteByteArrayFromInputStream(in, len); + } + + /** + * Write byte array from the InputStream with uknown length. + * + * @param in InputStream. + * @return Number of bytes written or -1 if stream contains more than {@code MAX_ARRAY_SIZE} bytes. + */ + public int writeByteArrayFromInputStream(InputStream in) throws IOException { + out.unsafeEnsure(1 + 4); + + int writtenLen = doWriteByteArrayFromInputStream(in, MAX_ARRAY_SIZE); + + if (writtenLen == MAX_ARRAY_SIZE && in.read() != -1) Review Comment: Generally any call to InputStream in all other new stream-related methods can block as well. I think it's not a problem if method is called from the Thin JDBC Driver only (which is true for now). Since it's a user application thread would block. On the side if (in future) some server code would call these methods it may be a problem. *** Reading asyncroniously with timeout looks an overkill for me for the Thin JDBC driver case. May be just take these methods outside of the BinaryWriterExImpl to JDBC-specific part (to SqlListenerUtils). Initially I did so but decided that it's better to have the serialization code at the same file. *** What is your preference for this? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org