Package i2p.susi.util

Class MemoryBuffer

  • All Implemented Interfaces:
    Buffer

    public class MemoryBuffer
    extends Object
    implements Buffer
    Buffer backed by a byte array. Use for small amounts of data only.
    Since:
    0.9.34
    • Constructor Detail

      • MemoryBuffer

        public MemoryBuffer()
      • MemoryBuffer

        public MemoryBuffer​(int size)
    • Method Detail

      • readComplete

        public void readComplete​(boolean success)
        Description copied from interface: Buffer
        Top-level reader MUST call this to close the input stream.
        Specified by:
        readComplete in interface Buffer
      • writeComplete

        public void writeComplete​(boolean success)
        Deletes the data if success is false
        Specified by:
        writeComplete in interface Buffer
        Parameters:
        success - if false, deletes any resources
      • getLength

        public int getLength()
        Current size.
        Specified by:
        getLength in interface Buffer
      • getOffset

        public int getOffset()
        Specified by:
        getOffset in interface Buffer
        Returns:
        0 always
      • getContent

        public byte[] getContent()
        Returns:
        content if writeComplete(true) was called, otherwise null