Exemple #1
0
 public static Compression guessCompressionMethod(byte [] bits){
   AutoBuffer ab = new AutoBuffer(bits);
   // Look for ZIP magic
   if( bits.length > ZipFile.LOCHDR && ab.get4(0) == ZipFile.LOCSIG )
     return Compression.ZIP;
   if( bits.length > 2 && ab.get2(0) == GZIPInputStream.GZIP_MAGIC )
     return Compression.GZIP;
   return Compression.NONE;
 }
Exemple #2
0
 @Override public IcedHashMap<K,V> read(AutoBuffer bb) {
   int n = bb.get4();
   for(int i = 0; i < n; ++i)
     put(bb.<K>get(),bb.<V>get());
   return this;
 }
Exemple #3
0
 @Override public AutoBuffer write(AutoBuffer bb) {
   bb.put4(size());
   for(Map.Entry<K, V> e:entrySet())bb.put(e.getKey()).put(e.getValue());
   return bb;
 }
Exemple #4
0
 @Override public IcedArrayList<T> read(AutoBuffer bb) {
   int n = bb.get4();
   for(int i = 0; i < n; ++i)
     add(bb.<T>get());
   return this;
 }
Exemple #5
0
 @Override public AutoBuffer write(AutoBuffer bb) {
   bb.put4(size());
   for(T t:this)
     bb.put(t);
   return bb;
 }