public String serializeToString ( ) { final StringBuilder sb = new StringBuilder ( ) ; //start the string with parameters of the sketch final int serVer = SER_VER ; //0 final int famID = Family . FREQUENCY . getID ( ) ; //1 final int lgMaxMapSz = lgMaxMapSize ; //2 final int flags = ( hashMap . getNumActive ( ) == 0 ) ? EMPTY_FLAG_MASK : 0 ; //3 final String fmt = "%d,%d,%d,%d,%d,%d," ; final String s = String . format ( fmt , serVer , famID , lgMaxMapSz , flags , streamWeight , offset ) ; sb . append ( s ) ; sb . append ( hashMap . serializeToString ( ) ) ; //numActive, curMaplen, key[i], value[i], ... // maxMapCap, samplesize are deterministic functions of maxMapSize, // so we don't need them in the serialization return sb . toString ( ) ; }
Returns a String representation of this sketch