11package com .microsoft .applicationinsights .internal .statsbeat ;
22
3- import java .util .Base64 ;
43import java .util .HashMap ;
54import java .util .HashSet ;
65import java .util .Map ;
@@ -81,16 +80,15 @@ public final class StatsbeatTestUtils {
8180 FEATURE_MAP_DECODING .put (5 , Feature .JAVA_VENDOR_OTHER );
8281 }
8382
84- static Set <String > decodeInstrumentations (String based64String ) {
85- return decode (based64String , INSTRUMENTATION_MAP_DECODING );
83+ static Set <String > decodeInstrumentations (long number ) {
84+ return decode (number , INSTRUMENTATION_MAP_DECODING );
8685 }
8786
88- static Set <Feature > decodeFeature (String based64String ) {
89- return decode (based64String , FEATURE_MAP_DECODING );
87+ static Set <Feature > decodeFeature (long num ) {
88+ return decode (num , FEATURE_MAP_DECODING );
9089 }
9190
92- private static <E > Set <E > decode (String based64String , Map <Integer , E > decodedMap ) {
93- long num = convertBase64EncodedStringToLong (based64String );
91+ private static <E > Set <E > decode (long num , Map <Integer , E > decodedMap ) {
9492 Set <E > result = new HashSet <>();
9593 for (Map .Entry <Integer , E > entry : decodedMap .entrySet ()) {
9694 double value = entry .getKey ();
@@ -101,17 +99,4 @@ private static <E> Set<E> decode(String based64String, Map<Integer, E> decodedMa
10199 }
102100 return result ;
103101 }
104-
105- // convert base64 encoded string to long
106- static long convertBase64EncodedStringToLong (String base64EncodedString ) {
107- byte [] bytes = Base64 .getDecoder ().decode (base64EncodedString .getBytes ());
108- long result = 0 ;
109- for (int i = 0 ; i < bytes .length ; i ++) {
110- result += ((long ) bytes [i ] & 0xffL ) << (8 * i ); // use Big Endian Byte Order.
111- }
112- return result ;
113- }
114-
115- private StatsbeatTestUtils () {
116- }
117102}
0 commit comments