Example #1
0
 private void writeObject(java.io.ObjectOutputStream out) throws IOException {
   out.writeFloat(_goodness);
   out.writeInt(getWidth());
   out.writeInt(getHeight());
   int[] row = new int[getWidth()];
   for (int y = 0; y < getHeight(); y++) {
     _i.getRGB(0, y, row.length, 1, row, 0, 0);
     out.writeObject(row);
   }
 }
Example #2
0
  /**
   * Serialize this deque.
   *
   * @serialData The current size (<tt>int</tt>) of the deque, followed by all of its elements (each
   *     an object reference) in first-to-last order.
   */
  private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
    s.defaultWriteObject();

    // Write out size
    s.writeInt(size());

    // Write out elements in order.
    int mask = elements.length - 1;
    for (int i = head; i != tail; i = (i + 1) & mask) s.writeObject(elements[i]);
  }
 // Special serializer: output XML as serialization
 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   write(baos);
   String str = baos.toString();
   ;
   // System.out.println("str='"+str+"'");
   out.writeUTF(str);
 }
  /**
   * Save the state of the <tt>ConcurrentHashMap</tt> instance to a stream (i.e., serialize it).
   *
   * @param s the stream
   * @serialData the key (Object) and value (Object) for each key-value mapping, followed by a null
   *     pair. The key-value mappings are emitted in no particular order.
   */
  private void writeObject(java.io.ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();

    for (int k = 0; k < segments.length; ++k) {
      Segment<K, V> seg = (Segment<K, V>) segments[k];
      seg.lock();
      try {
        HashEntry[] tab = seg.table;
        for (int i = 0; i < tab.length; ++i) {
          for (HashEntry<K, V> e = (HashEntry<K, V>) tab[i]; e != null; e = e.next) {
            s.writeObject(e.key);
            s.writeObject(e.value);
          }
        }
      } finally {
        seg.unlock();
      }
    }
    s.writeObject(null);
    s.writeObject(null);
  }
Example #5
0
 /**
  * Save the state to a stream (that is, serialize it).
  *
  * @param s the stream
  */
 private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
   boolean fair = transferer instanceof TransferQueue;
   if (fair) {
     qlock = new ReentrantLock(true);
     waitingProducers = new FifoWaitQueue();
     waitingConsumers = new FifoWaitQueue();
   } else {
     qlock = new ReentrantLock();
     waitingProducers = new LifoWaitQueue();
     waitingConsumers = new LifoWaitQueue();
   }
   s.defaultWriteObject();
 }
 private void writeObject(java.io.ObjectOutputStream out) throws IOException {
   out.defaultWriteObject();
 }
 /**
  * WriteObject is called to save the state of the ServicePermission to a stream. The actions are
  * serialized, and the superclass takes care of the name.
  */
 private void writeObject(java.io.ObjectOutputStream s) throws IOException {
   // Write out the actions. The superclass takes care of the name
   // call getActions to make sure actions field is initialized
   if (actions == null) getActions();
   s.defaultWriteObject();
 }
Example #8
0
 private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
   stream.defaultWriteObject();
   write(stream);
 }