Пример #1
0
  /**
   * Reconstitute the <tt>ConcurrentHashMap</tt> instance from a stream (i.e., deserialize it).
   *
   * @param s the stream
   */
  private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();

    // Initialize each segment to be minimally sized, and let grow.
    for (int i = 0; i < segments.length; ++i) {
      segments[i].setTable(new HashEntry[1]);
    }

    // Read the keys and values, and put the mappings in the table
    for (; ; ) {
      K key = (K) s.readObject();
      V value = (V) s.readObject();
      if (key == null) break;
      put(key, value);
    }
  }
Пример #2
0
 private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
   _goodness = in.readFloat();
   int w = in.readInt();
   int h = in.readInt();
   _i = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
   for (int y = 0; y < h; y++) {
     int[] row = (int[]) in.readObject();
     _i.setRGB(0, y, w, 1, row, 0, 0);
   }
 }
Пример #3
0
  /** Deserialize this deque. */
  private void readObject(java.io.ObjectInputStream s)
      throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();

    // Read in size and allocate array
    int size = s.readInt();
    allocateElements(size);
    head = 0;
    tail = size;

    // Read in all elements in the proper order.
    for (int i = 0; i < size; i++) elements[i] = s.readObject();
  }