Java tutorial
//package com.java2s; /* * %W% %E% * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.util.List; import java.util.Iterator; import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.se.spi.ior.Identifiable; public class Main { /** Write all Identifiables that we contain to os. The total * length must be written before this method is called. */ public static void writeIdentifiableSequence(List container, OutputStream os) { os.write_long(container.size()); Iterator iter = container.iterator(); while (iter.hasNext()) { Identifiable obj = (Identifiable) (iter.next()); os.write_long(obj.getId()); obj.write(os); } } }