MicroGery commented on issue #39792:
URL: https://github.com/apache/arrow/issues/39792#issuecomment-1912945362

    jduo:37704-java-schema-tobytearray
   `  /**
      * Returns the serialized flatbuffer bytes of the schema wrapped in a 
message table.
      * Use {@link #deserializeMessage() to rebuild the Schema.}
      */
     public byte[] serializeAsMessage() {
       ByteArrayOutputStream out = new ByteArrayOutputStream();
       try (WriteChannel channel = new WriteChannel(Channels.newChannel(out))) {
         long size = MessageSerializer.serialize(
             new WriteChannel(Channels.newChannel(out)), this);
         return out.toByteArray();
       } catch (IOException ex) {
         throw new RuntimeException(ex);
       }
     }`
   Yes, I used the serializeAsMessage method, which uses MessageSerializer, and 
I got an array starting with oxffffff. According to @zeroshade , the valid 
length is 768 bytes indicated by the second 32-bit integer. Now I'm trying to 
construct an arrow::Schema object in C++ code using the ReadSchema method you 
said. How do I create an io::InputStream? Is it through Buffer or BufferReader?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to