Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #5
0
 @Override public AutoBuffer write(AutoBuffer bb) {
   bb.put4(size());
   for(T t:this)
     bb.put(t);
   return bb;
 }