Examples of CircularBuffer


Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

    }

    @Test
    public void testBufferAdd() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(payload, 0, payload.length);
        assertEquals(payload.length, buffer.availableForWrite());
        buffer.write(payload, 0, payload.length);
        assertEquals(0, buffer.availableForWrite());
        buffer.write(payload, 0, payload.length);
        assertEquals(0, buffer.availableForWrite());
    }
View Full Code Here

Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

        assertEquals(0, buffer.availableForWrite());
    }

    @Test
    public void testBufferDrain() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(payload, 0, payload.length);

        byte[] data = new byte[payload.length >> 1];
        assertEquals(data.length, buffer.read(data, 0, data.length));
        assertEquals(data.length, buffer.read(data, 0, data.length));
        assertEquals(0, buffer.read(data, 0, data.length));
    }
View Full Code Here

Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

        assertEquals(0, buffer.read(data, 0, data.length));
    }

    @Test
    public void testBufferCompare() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(new byte[payload.length >> 1], 0, payload.length >> 1);
        buffer.write(payload, 0, payload.length);
        buffer.compareTo(payload, 0, payload.length);
    }
View Full Code Here

Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

        assertEquals(HexUtils.byteArrayToHexString(expected), HexUtils.byteArrayToHexString(actual));
    }

    @Test
    public void testBufferAdd() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(payload, 0, payload.length);
        assertEquals(payload.length, buffer.availableForWrite());
        buffer.write(payload, 0, payload.length);
        assertEquals(0, buffer.availableForWrite());
        buffer.write(payload, 0, payload.length);
        assertEquals(0, buffer.availableForWrite());
    }
View Full Code Here

Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

        assertEquals(0, buffer.availableForWrite());
    }

    @Test
    public void testBufferDrain() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(payload, 0, payload.length);

        byte[] data = new byte[payload.length >> 1];
        assertEquals(data.length, buffer.read(data, 0, data.length));
        assertEquals(data.length, buffer.read(data, 0, data.length));
        assertEquals(0, buffer.read(data, 0, data.length));
    }
View Full Code Here

Examples of org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer

        assertEquals(0, buffer.read(data, 0, data.length));
    }

    @Test
    public void testBufferCompare() throws Exception {
        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
        buffer.write(new byte[payload.length >> 1], 0, payload.length >> 1);
        buffer.write(payload, 0, payload.length);
        buffer.compareTo(payload, 0, payload.length);
    }
View Full Code Here

Examples of org.rzo.yajsw.io.CircularBuffer

     */
    public void setDrain(boolean drain)
    {
      if (drain && !_drain)
      {
        _drainBuffer = new CircularBuffer(16384, false);
        _drainReader = new BufferedReader(_drainBuffer);
      }
      else if (!drain && _drain)
      {
        try
View Full Code Here

Examples of org.wso2.carbon.logging.appenders.CircularBuffer

            fileAppender.activateOptions();
          }

          if (appender instanceof MemoryAppender) {
            MemoryAppender memoryAppender = (MemoryAppender) appender;
            memoryAppender.setCircularBuffer(new CircularBuffer(200));
            memoryAppender.activateOptions();
          }

          if (appender instanceof SyslogAppender) {
            SyslogAppender syslogAppender = (SyslogAppender) appender;
View Full Code Here

Examples of org.wso2.carbon.logging.appenders.CircularBuffer

                        Boolean.toString(false));
            }

            if (appender instanceof MemoryAppender) {
                MemoryAppender memoryAppender = (MemoryAppender) appender;
                memoryAppender.setCircularBuffer(new CircularBuffer(LoggingConstants.MEMORY_APPENDER_BUFFER_SZ));
                memoryAppender.activateOptions();
            }

            // normally all the appenders inherit from AppenderSkelton
            if (appender instanceof AppenderSkeleton) {
View Full Code Here

Examples of org.wso2.carbon.logging.appenders.CircularBuffer

    public TracerServiceInfo getMessages(int numberOfMessages, String filter) throws AxisFault {

        ConfigurationContext configContext = getConfigContext();
        AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
        CircularBuffer msgSeqBuff = getMessageSequenceBuffer();
        Object[] messageObjs;
        TracerServiceInfo tracerServiceInfo = new TracerServiceInfo();
        AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER);

        if (axisModule == null) {
            throw new AxisFault(TracerConstants.WSO2_TRACER + " module is not available");
        }
        TracePersister tracePersister = getTracePersister();
        tracerServiceInfo.setTracePersister(tracePersister.getClass().getName());
        if (tracePersister.isTracingEnabled()) {
            if (!axisConfiguration.isEngaged(axisModule)) {
                axisConfiguration.engageModule(axisModule);
            }
            tracerServiceInfo.setFlag("ON");
        } else {
            if (axisConfiguration.isEngaged(axisModule)) {
                axisConfiguration.disengageModule(axisModule);
            }
            tracerServiceInfo.setFlag("OFF");
        }
        if (msgSeqBuff == null) {
            tracerServiceInfo.setEmpty(true);
            return tracerServiceInfo;
        } else {
            messageObjs = msgSeqBuff.getObjects(numberOfMessages);

            if (messageObjs.length == 0) {
                tracerServiceInfo.setEmpty(true);
                return tracerServiceInfo;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.