resets the state of this buffer (empties it)

@param resetChunkSize
965255
public final void reset(boolean resetChunkSize) {
        markBufferChanged();
        firstChunk = null;
        lastChunk = null;
        totalCharsInList = 0;
        totalCharsInDynamicChunks = -1;
        sizeAtLeast = -1;
        if (resetChunkSize) {
            chunkSize = firstChunkSize;
            totalChunkSize = 0;
        }
        if (allocBuffer == null) {
            allocBuffer = new AllocatedBuffer(chunkSize);
        } else {
            allocBuffer.clear();
        }
        if (dynamicChunkMap == null) {
            dynamicChunkMap = new HashMap<StreamCharBufferKey, StreamCharBufferSubChunk>();
        } else {
            dynamicChunkMap.clear();
        }
    }
254707
public void reset() {
    n_ = 0;
    combinedBufferItemCapacity_ = 2 * Math.min(DoublesSketch.MIN_K, k_); //the min is important
    combinedBuffer_ = new Object[combinedBufferItemCapacity_];
    baseBufferCount_ = 0;
    bitPattern_ = 0;
    minValue_ = null;
    maxValue_ = null;
  }
152533
public void resetBuffer()
        throws IllegalStateException
    {
        // Shutdown filters without observation
        
        if (_out!=null && _out!=_realOut)
        {
            ArrayList save_observers=_observers;
            _observers=null;
            _nulled=true;
            try
            {
                // discard current buffer and set it to output
                if (_bufferedOut!=null)    
                {
                    _bufferedOut.resetStream();
                    if (_bufferedOut instanceof ChunkingOutputStream)
                        ((ChunkingOutputStream)_bufferedOut).setChunking(false);
                }
            }
            catch(Exception e)
            {
                LogSupport.ignore(log,e);
            }
            finally
            {
                _observers=save_observers;
            }
        }
        _contentLength=-1;
        _nulled=false;
	    _bytes=0;
        _written=false;
        _out=_realOut;
        try
        {
            notify(OutputObserver.__RESET_BUFFER);
        }
        catch(IOException e)
        {
            LogSupport.ignore(log,e);
        }
    }
211957
public void setCacheSize(int cacheSize) {
    this.cacheSize = cacheSize;

    long toDelete = map.size() - this.cacheSize;
    if(toDelete <= 0) {
      return;
    }

    List<Integer> keys = new ArrayList<>(map.keySet());
    Collections.reverse(keys);

    for(Integer id : keys) {
      P page = map.remove(id);
      file.writePage(page);
    }
  }
1351545
@Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);

        clear();
    }
676695
public void resetStream()
        throws IOException, IllegalStateException
    {
        if (isChunking())
            close();
        
        _out=null;
        _nulled=true;
        if (_bufferedOut!=null)
        {
            _bufferedOut.resetStream();
            if (_bufferedOut instanceof ChunkingOutputStream)
                ((ChunkingOutputStream)_bufferedOut).setChunking(false);
        }
        if (_iso8859writer!=null)
            _iso8859writer.flush();
        if (_utf8writer!=null)
            _utf8writer.flush();
        if (_asciiwriter!=null)
            _asciiwriter.flush();

        _bytes=0;
        _written=false;
        _out=_realOut;
        _closing=false;
        _contentLength=-1;
        _nulled=false;
        
        if (_observers!=null)
            _observers.clear();
    }
467298
@Override
    public void reset() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "reset");

        // After reset has been called, the message body is immutable (the only way of changing it is to
        // call clearBody and start again). If we're in Write Mode, we need to convert the writeStream
        // to a byte array and switch into read mode. If we're in Read Mode, we must have already done this,
        // so we don't want to do it again
        if (!isBodyReadOnly()) {

            // If the producer won't modify the payload after set,skip the
            // encoding of the write stream because encoding is not needed
            if (!producerWontModifyPayloadAfterSet) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(this, tc, "Body is writeable & producer might modify the payload, so encode the write stream");

                // Convert the stream in which the message was being assembled to a byte array
                dataBuffer = _writeBytes.toByteArray();

                // store the content in the JS msg
                lastEncoding = integerEncoding | floatEncoding;
                jsBytesMsg.setBytes(_exportBody(lastEncoding));
                bodySetInJsMsg = true;

                // Throw away the write stream
                writeStream = null;
                _writeBytes = null;
            }

            dataStart = 0; // start from the first byte in the buffer

            // The message is now read only
            setBodyReadOnly();
        }

        // For some odd reason, after receiving an 'empty' message the dataBuffer
        // is null rather than pointing to an empty array. This will compensate
        // hopefully without any side effects - SXA #58832
        if (dataBuffer == null)
            dataBuffer = new byte[0];

        // Create a Byte array input stream for the readxxx methods to operate on. We have to create a new
        // stream each time (rather than call the stream's read method), as the stream may have a position
        // marked in it that isn't at the start.
        _readBytes = new ByteArrayInputStream(dataBuffer);
        readStream = new DataInputStream(_readBytes);

        // Jump over any header that might be present in the dataBuffer
        // JBK - I don't think we will ever have dataStart!=0 in JS, but I'm
        // leaving the capability here until I understand better.
        try {
            readStream.skip(dataStart);
        } catch (IOException e) {
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "reset");
    }
1307774
private final void reset() {
	backtrackStack.clear();
	actionStack.clear();
	stateStack.clear();
	parserErrors.clear();
	streamPosition = 0;
	stepCounter = 0;
	stateStack.push(0);
	maxPosition = 0;
	shiftIgnoredTokens();
    }
1327897
private void updateLargestChunkSoFarSize(@NotNull ByteBuffer outBuffer) {
        int sizeOfThisChunk = (int) (outBuffer.limit() - limitOfLast);
        if (largestChunkSoFar < sizeOfThisChunk)
            largestChunkSoFar = sizeOfThisChunk;

        limitOfLast = outBuffer.limit();
    }
352275
public void setBufferSize(int size)
    {
        HttpOutputStream out = (HttpOutputStream)_httpResponse.getOutputStream();
        if (out.isWritten()  || _writer!=null && _writer.isWritten())
            throw new IllegalStateException("Output written");
        out.setBufferSize(size);
    }
415269
private void reset()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset");
      throwable = null;

      state = STATE_PARSING_PRIMARY_HEADER;

      unparsedPrimaryHeader.position(0);
      unparsedPrimaryHeader.limit(JFapChannelConstants.SIZEOF_PRIMARY_HEADER);

      unparsedConversationHeader.position(0);
      unparsedConversationHeader.limit(JFapChannelConstants.SIZEOF_CONVERSATION_HEADER);

      unparsedFirstSegment.position(0);
      unparsedFirstSegment.limit(JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER);

      unparsedPayloadData = null;
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset");
   }
971417
public void resetWithShared(char[] buf, int start, int len)
    {
        // Let's first mark things we need about input buffer
        mInputBuffer = buf;
        mInputStart = start;
        mInputLen = len;

        // Then clear intermediate values, if any:
        mResultString = null;
        mResultArray = null;

        // And then reset internal input buffers, if necessary:
        if (mHasSegments) {
            clearSegments();
        }
    }
704609
protected synchronized void reset(Connection connection,
                        ReceiveListener listener,
                        WsByteBuffer data,
                        int size,
                        int segmentType,
                        int requestNumber,
                        int priority,
                        boolean allocatedFromPool,
                        boolean partOfExchange,
                        Conversation conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset",
                                           new Object[]
                                           {
                                              connection,
                                              listener,
                                              data,
                                              ""+size,
                                              ""+segmentType,
                                              ""+requestNumber,
                                              ""+priority,
                                              ""+allocatedFromPool,
                                              ""+partOfExchange,
                                              conversation
                                           });

      this.connection = connection;
      this.listener = listener;
      this.data = data;
      this.size = size;
      this.segmentType = segmentType;
      this.requestNumber = requestNumber;
      this.priority = priority;
      this.allocatedFromPool = allocatedFromPool;
      this.partOfExchange = partOfExchange;
      this.conversation = conversation;
      setDispatchable(null);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset");
   }
510925
final protected synchronized void set(boolean verifyChecksum,
      Checksum sum, int maxChunkSize, int checksumSize ) {
    this.verifyChecksum = verifyChecksum;
    this.sum = sum;
    this.buf = new byte[maxChunkSize];
    this.checksum = new byte[checksumSize];
    this.count = 0;
    this.pos = 0;
  }
941203
function clearBuffer(stream, state) {
  state.bufferProcessing = true;

  for (var c = 0; c < state.buffer.length; c++) {
    var entry = state.buffer[c];
    var chunk = entry.chunk;
    var encoding = entry.encoding;
    var cb = entry.callback;
    var len = state.objectMode ? 1 : chunk.length;

    doWrite(stream, state, len, chunk, encoding, cb);

    // if we didn't call the onwrite immediately, then
    // it means that we need to wait until it does.
    // also, that means that the chunk and cb are currently
    // being processed, so move the buffer counter past them.
    if (state.writing) {
      c++;
      break;
    }
  }

  state.bufferProcessing = false;
  if (c < state.buffer.length)
    state.buffer = state.buffer.slice(c);
  else
    state.buffer.length = 0;
}
801598
void resetState(Log log) {
    nextSnapshotIndex = 0;
    nextSnapshotOffset = 0;
    matchIndex = 0;
    nextIndex = log.lastIndex() + 1;
    heartbeatTime = 0;
    heartbeatStartTime = 0;
    appending = 0;
    timeBuffer.reset();
    configuring = false;
    installing = false;
    appendSucceeded = false;
    failures = 0;
  }
320891
public void reset() {
        if (released.compareAndSet(true, false)) {
            synchronized (releasingLock) {
                if (!released.get()) {
                    impl.drainPermits();
                }
            }
        }
    }