java/hybridse-sdk/src/main/java/com/_4paradigm/hybridse/sdk/SerializableByteBuffer.java
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
        if (buffer == null) {
            throw new IOException("No backed buffer");
        }
        out.defaultWriteObject();
        out.writeInt(buffer.capacity());
        out.writeBoolean(buffer.isDirect());
        if (buffer.hasArray()) {
            out.write(buffer.array(), 0, buffer.capacity());
        } else {
            byte[] bytes = new byte[buffer.capacity()];
            ByteBuffer view = buffer.duplicate();
            view.rewind();
            view.get(bytes, 0, bytes.length);
            out.write(bytes);
        }
        out.writeInt(MAGIC_END_TAG);
    }
/**
     * Serialization method to save the ByteBuffer.
     *
     * @serialData The length of the ByteBuffer type ID (int),
     *             followed by ByteBuffer isDirect flag (boolean)
     *             followed by buffer array
     */
Serialization method to save the ByteBuffer.
@serialData The length of the ByteBuffer type ID (int),
followed by ByteBuffer isDirect flag (boolean)
followed by buffer array
Serialization method to save the ByteBuffer . @serialData The length of the ByteBuffer type ID ( int ) followed by ByteBuffer isDirect flag ( boolean ) followed by buffer array
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
        if (buffer == null) {
            throw new IOException("No backed buffer");
        }
        out.defaultWriteObject();
        out.writeInt(buffer.capacity());
        out.writeBoolean(buffer.isDirect());
        if (buffer.hasArray()) {
            out.write(buffer.array(), 0, buffer.capacity());
        } else {
            byte[] bytes = new byte[buffer.capacity()];
            ByteBuffer view = buffer.duplicate();
            view.rewind();
            view.get(bytes, 0, bytes.length);
            out.write(bytes);
        }
        out.writeInt(MAGIC_END_TAG);
    }
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { if ( buffer == null ) { throw new IOException ( "No backed buffer" ) ; } out . defaultWriteObject ( ) ; out . writeInt ( buffer . capacity ( ) ) ; out . writeBoolean ( buffer . isDirect ( ) ) ; if ( buffer . hasArray ( ) ) { out . write ( buffer . array ( ) , 0 , buffer . capacity ( ) ) ; } else { byte [ ] bytes = new byte [ buffer . capacity ( ) ] ; ByteBuffer view = buffer . duplicate ( ) ; view . rewind ( ) ; view . get ( bytes , 0 , bytes . length ) ; out . write ( bytes ) ; } out . writeInt ( MAGIC_END_TAG ) ; }
Serialization method to save the ByteBuffer.
Serialization method to save the ByteBuffer .