Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.dataformat.smile;

Simple helper class used for implementing simple reuse system for Smile-specific buffers that are used.

Parameters:
<T> Type of name entries stored in arrays to recycle
 
 public class SmileBufferRecycler<T>
    public final static int DEFAULT_NAME_BUFFER_LENGTH = 64;
    public final static int DEFAULT_STRING_VALUE_BUFFER_LENGTH = 64;
    
    protected T[] _seenNamesBuffer;
    protected T[] _seenStringValuesBuffer;
    public SmileBufferRecycler() { }
    public T[] allocSeenNamesBuffer()
    {
        // 11-Feb-2011, tatu: Used to alloc here; but due to generics, can't easily any more
        T[] result = ;
        if (result != null) {
            // let's ensure we don't retain it here, unless returned
             = null;
            // note: caller must have cleaned it up before returning
        }
        return result;
    }
    public T[] allocSeenStringValuesBuffer()
    {
        // 11-Feb-2011, tatu: Used to alloc here; but due to generics, can't easily any more
        T[] result = ;
        if (result != null) {
             = null;
            // note: caller must have cleaned it up before returning
        }
        return result;
    }
    
    public void releaseSeenNamesBuffer(T[] buffer) {
         = buffer;
    }
    public void releaseSeenStringValuesBuffer(T[] buffer) {
         = buffer;
    }
New to GrepCode? Check out our FAQ X