/**
 * @fileoverview High-performance buffer accumulator for string data.
 *
 * This utility reduces GC pressure by avoiding repeated string concatenation (`+=`).
 * Instead, chunks are pushed to an array and joined only when needed.
 * Automatically trims when size limits are exceeded.
 *
 * @module utils/buffer-accumulator
 */
import type { BufferConfig } from '../types.js';
/**
 * High-performance buffer accumulator using array-based collection.
 *
 * Features:
 * - Efficient append via array push (avoids O(n) string concat)
 * - Lazy join on read (consolidates only when accessed)
 * - Automatic trimming when max size exceeded
 * - Optional callback on trim for logging/metrics
 *
 * @example
 * ```typescript
 * const buffer = new BufferAccumulator({
 *   maxSize: 2 * 1024 * 1024,  // 2MB
 *   trimSize: 1.5 * 1024 * 1024,  // Trim to 1.5MB
 *   onTrim: (bytes) => console.log(`Trimmed ${bytes} bytes`)
 * });
 *
 * buffer.append('chunk1');
 * buffer.append('chunk2');
 * console.log(buffer.value);  // Joins and returns full content
 * ```
 */
export declare class BufferAccumulator {
    private chunks;
    private totalLength;
    private readonly maxSize;
    private readonly trimSize;
    private readonly onTrim?;
    /**
     * Creates a new BufferAccumulator.
     *
     * @param config - Buffer configuration with max/trim sizes
     */
    constructor(config: BufferConfig);
    /**
     * Creates a new BufferAccumulator with simple size parameters.
     *
     * @param maxSize - Maximum buffer size before trimming
     * @param trimSize - Size to trim to when max is exceeded
     */
    constructor(maxSize: number, trimSize: number);
    /**
     * Append data to the buffer.
     * Automatically trims if maxSize is exceeded.
     *
     * @param data - String data to append
     */
    append(data: string): void;
    /**
     * Get the full buffer content.
     * Consolidates chunks on access for efficient subsequent reads.
     */
    get value(): string;
    /**
     * Get current buffer length without joining chunks.
     */
    get length(): number;
    /**
     * Check if buffer is empty.
     */
    get isEmpty(): boolean;
    /**
     * Clear the buffer completely.
     */
    clear(): void;
    /**
     * Set buffer to a specific value, replacing all content.
     *
     * @param value - New buffer content
     */
    set(value: string): void;
    /**
     * Get the last N characters from the buffer.
     * Useful for checking recent content without reading the entire buffer.
     *
     * @param n - Number of characters to get from the end
     * @returns The last N characters (or entire buffer if smaller)
     */
    tail(n: number): string;
    /**
     * Check if buffer ends with a specific string.
     *
     * @param suffix - String to check for
     * @returns True if buffer ends with the suffix
     */
    endsWith(suffix: string): boolean;
    /**
     * Search for a pattern in the buffer (from the end).
     *
     * @param pattern - String or RegExp to search for
     * @param fromEnd - Number of characters from end to search within (default: entire buffer)
     * @returns True if pattern is found
     */
    contains(pattern: string | RegExp, fromEnd?: number): boolean;
    /**
     * Trim buffer to keep only the most recent data.
     * Called automatically when maxSize is exceeded.
     */
    private trim;
}
//# sourceMappingURL=buffer-accumulator.d.ts.map