Class RingBuffer


  • class RingBuffer
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] buf  
      private int readIndex  
      private int size  
      private int writeIndex  
    • Constructor Summary

      Constructors 
      Constructor Description
      RingBuffer​(int maxSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isEmpty()  
      boolean isFull()  
      boolean isFull​(int len)  
      int maxSize()  
      int read​(byte[] chunk)  
      private void readBytes​(byte[] chunk, int len)  
      int size()  
      void write​(byte[] b, int off, int len)  
      void write​(int b)  
      private void writeBytes​(byte[] b, int off, int len)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buf

        private byte[] buf
      • writeIndex

        private int writeIndex
      • readIndex

        private int readIndex
      • size

        private int size
    • Constructor Detail

      • RingBuffer

        public RingBuffer​(int maxSize)
    • Method Detail

      • write

        public void write​(byte[] b,
                          int off,
                          int len)
      • write

        public void write​(int b)
      • read

        public int read​(byte[] chunk)
      • readBytes

        private void readBytes​(byte[] chunk,
                               int len)
      • writeBytes

        private void writeBytes​(byte[] b,
                                int off,
                                int len)
      • maxSize

        public int maxSize()
      • size

        public int size()
      • isFull

        public boolean isFull()
      • isFull

        public boolean isFull​(int len)
      • isEmpty

        public boolean isEmpty()