/** java.io.ObjectOutputStream#writeChar(int) */
 public void test_writeCharI() throws Exception {
   // Test for method void java.io.ObjectOutputStream.writeChar(int)
   oos.writeChar('T');
   oos.close();
   ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
   assertEquals("Wrote incorrect char value", 'T', ois.readChar());
 }
Exemplo n.º 2
0
 private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
   playerId = stream.readChar();
   event = (Event) stream.readObject();
   splitAction = (SPLIT_ACTION) stream.readObject();
   newOwner = stream.readUTF();
   leavers = (List<Character>) stream.readObject();
 }
  /** @since 1.1 */
  private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    keys = new char[s.readInt()];
    states = new byte[keys.length];
    values = (Object[]) new Object[keys.length];
    used = size;

    for (int n = 0; n < size; n++) {
      char key = s.readChar();
      Object value = s.readObject();

      //  first hash
      int h = Math.abs(keyhash.hash(key));
      int i = h % keys.length;
      if (states[i] != EMPTY) {
        //  second hash
        int c = 1 + (h % (keys.length - 2));
        for (; ; ) {
          i -= c;
          if (i < 0) i += keys.length;
          if (states[i] == EMPTY) break;
        }
      }
      states[i] = OCCUPIED;
      keys[i] = key;
      values[i] = value;
    }
  }
 @SuppressWarnings("unchecked")
 private void readObject(java.io.ObjectInputStream s)
     throws java.io.IOException, ClassNotFoundException {
   s.defaultReadObject();
   key = new char[size];
   value = new int[size];
   for (int i = 0; i < size; i++) {
     key[i] = s.readChar();
     value[i] = s.readInt();
   }
 }
  private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    int version = in.readInt();
    int string1Length = in.readInt();
    int string2Length = in.readInt();
    String string1 = (String) in.readObject();
    String string2 = (String) in.readObject();
    int size = in.readInt();
    if (size == NULL_INTEGER) {
      string1Blocks = null;
    } else {
      string1Blocks = new String[size];
      for (int i = 0; i < size; i++) {
        string1Blocks[i] = (String) in.readObject();
      }
    }

    size = in.readInt();
    if (size == NULL_INTEGER) {
      string2Blocks = null;
    } else {
      string2Blocks = new String[size];
      for (int i = 0; i < size; i++) {
        string2Blocks[i] = (String) in.readObject();
      }
    }

    TObjectIntHashMap string1Present = (TObjectIntHashMap) in.readObject();
    TObjectIntHashMap string2Present = (TObjectIntHashMap) in.readObject();
    TObjectIntHashMap lexicon = (TObjectIntHashMap) in.readObject();

    size = in.readInt();
    if (size == NULL_INTEGER) {
      block1Indices = null;
    } else {
      block1Indices = new int[size];
      for (int i = 0; i < size; i++) {
        block1Indices[i] = in.readInt();
      }
    }

    size = in.readInt();
    if (size == NULL_INTEGER) {
      block2Indices = null;
    } else {
      block2Indices = new int[size];
      for (int i = 0; i < size; i++) {
        block2Indices[i] = in.readInt();
      }
    }

    delim = in.readChar();
  }
 /** java.io.ObjectOutputStream#writeChars(java.lang.String) */
 public void test_writeCharsLjava_lang_String() throws Exception {
   // Test for method void
   // java.io.ObjectOutputStream.writeChars(java.lang.String)
   int avail = 0;
   char[] buf = new char[10];
   oos.writeChars("HelloWorld");
   oos.close();
   ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
   // Number of prim data bytes in stream / 2 to give char index
   avail = ois.available() / 2;
   for (int i = 0; i < avail; ++i) buf[i] = ois.readChar();
   ois.close();
   assertEquals("Wrote incorrect chars", "HelloWorld", new String(buf, 0, 10));
 }
 @SuppressWarnings("unchecked")
 private void readObject(java.io.ObjectInputStream s)
     throws java.io.IOException, ClassNotFoundException {
   s.defaultReadObject();
   n = arraySize(size, f);
   maxFill = maxFill(n, f);
   mask = n - 1;
   final K key[] = this.key = (K[]) new Object[n];
   final char value[] = this.value = new char[n];
   final boolean used[] = this.used = new boolean[n];
   K k;
   char v;
   for (int i = size, pos = 0; i-- != 0; ) {
     k = (K) s.readObject();
     v = s.readChar();
     pos = (it.unimi.dsi.fastutil.HashCommon.murmurHash3(strategy.hashCode((K) (k)))) & mask;
     while (used[pos]) pos = (pos + 1) & mask;
     used[pos] = true;
     key[pos] = k;
     value[pos] = v;
   }
   if (ASSERTS) checkTable();
 }
/*      */   private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
/* 1256 */     s.defaultReadObject();
/* 1257 */     this.n = HashCommon.arraySize(this.size, this.f);
/* 1258 */     this.maxFill = HashCommon.maxFill(this.n, this.f);
/* 1259 */     this.mask = (this.n - 1);
/* 1260 */     float[] key = this.key = new float[this.n];
/* 1261 */     char[] value = this.value = new char[this.n];
/* 1262 */     boolean[] used = this.used = new boolean[this.n];
/* 1263 */     long[] link = this.link = new long[this.n];
/* 1264 */     int prev = -1;
/* 1265 */     this.first = (this.last = -1);
/*      */ 
/* 1268 */     int i = this.size; for (int pos = 0; i-- != 0; ) {
/* 1269 */       float k = s.readFloat();
/* 1270 */       char v = s.readChar();
/* 1271 */       pos = HashCommon.murmurHash3(HashCommon.float2int(k)) & this.mask;
/* 1272 */       while (used[pos] != 0) pos = pos + 1 & this.mask;
/* 1273 */       used[pos] = true;
/* 1274 */       key[pos] = k;
/* 1275 */       value[pos] = v;
/* 1276 */       if (this.first != -1) {
/* 1277 */         link[prev] ^= (link[prev] ^ pos & 0xFFFFFFFF) & 0xFFFFFFFF;
/* 1278 */         link[pos] ^= (link[pos] ^ (prev & 0xFFFFFFFF) << 32) & 0x0;
/* 1279 */         prev = pos;
/*      */       }
/*      */       else {
/* 1282 */         prev = this.first = pos;
/*      */ 
/* 1284 */         link[pos] |= -4294967296L;
/*      */       }
/*      */     }
/* 1287 */     this.last = prev;
/* 1288 */     if (prev != -1)
/*      */     {
/* 1290 */       link[prev] |= 4294967295L;
/*      */     }
/*      */   }
Exemplo n.º 9
0
 private void readObject(java.io.ObjectInputStream stream)
     throws IOException, ClassNotFoundException {
   val = stream.readChar();
   taint = stream.readInt();
 }