Class MarshallingEncoder

    • Field Detail

      • LENGTH_PLACEHOLDER

        private static final byte[] LENGTH_PLACEHOLDER
      • estimatedLength

        private final int estimatedLength
    • Constructor Detail

      • MarshallingEncoder

        public MarshallingEncoder​(MarshallerProvider provider)
        Creates a new encoder with the estimated length of 512 bytes.
        Parameters:
        provider - the MarshallerProvider to use
      • MarshallingEncoder

        public MarshallingEncoder​(MarshallerProvider provider,
                                  int estimatedLength)
        Creates a new encoder.
        Parameters:
        provider - the MarshallerProvider to use
        estimatedLength - the estimated byte length of the serialized form of an object. If the length of the serialized form exceeds this value, the internal buffer will be expanded automatically at the cost of memory bandwidth. If this value is too big, it will also waste memory bandwidth. To avoid unnecessary memory copy or allocation cost, please specify the properly estimated value.