[ https://issues.apache.org/jira/browse/ARROW-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16215802#comment-16215802 ]
ASF GitHub Bot commented on ARROW-1474: --------------------------------------- icexelloss commented on a change in pull request #1203: ARROW-1474:[WIP] Java Vector Refactor (Implementation Phase 2) URL: https://github.com/apache/arrow/pull/1203#discussion_r146388341 ########## File path: java/vector/src/main/java/org/apache/arrow/vector/BaseNullableVariableWidthVector.java ########## @@ -761,4 +741,57 @@ protected final void handleSafe(int index, int dataLength) { reallocValueBuffer(); } } + + + /****************************************************************** + * * + * helper methods currently * + * used by JsonFileReader and * + * JsonFileWriter * + * * + ******************************************************************/ + + + public static ArrowBuf setSafeJsonHelper(ArrowBuf data, ArrowBuf offset, + BufferAllocator allocator, int index, byte[] value, + int valueCount) { + if (data == null) { + data = allocator.buffer(INITIAL_BYTE_COUNT); + } + final int currentBufferCapacity = data.capacity(); + final int currentStartOffset = offset.getInt(index * OFFSET_WIDTH); + while (currentBufferCapacity < currentStartOffset + value.length) { + final ArrowBuf newBuf = allocator.buffer(currentBufferCapacity * 2); + newBuf.setBytes(0, data, 0, currentBufferCapacity); + data.release(); + data = newBuf; + } + data.setBytes(currentStartOffset, value, 0, value.length); + if (index == (valueCount - 1)) { + data.writerIndex(offset.getInt(valueCount * OFFSET_WIDTH)); + } + return data; + } + + public static byte[] get(final ArrowBuf data, final ArrowBuf offset, int index) { Review comment: This is discussed https://github.com/apache/arrow/pull/1203#issuecomment-338690930 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > [JAVA] ValueVector hierarchy (Implementation Phase 2) > ----------------------------------------------------- > > Key: ARROW-1474 > URL: https://issues.apache.org/jira/browse/ARROW-1474 > Project: Apache Arrow > Issue Type: Sub-task > Reporter: Jacques Nadeau > Assignee: Siddharth Teotia > Labels: pull-request-available > -- This message was sent by Atlassian JIRA (v6.4.14#64029)