private static Object readBoundary ( ObjectInput in , byte header ) throws IOException , ClassNotFoundException { int past = ( header & 0x1 ) ; if ( past == 1 ) { return Boundary . infinitePast ( ) ; } int future = ( header & 0x2 ) ; if ( future == 2 ) { return Boundary . infiniteFuture ( ) ; } int openClosed = in . readByte ( ) ; IntervalEdge edge ; switch ( openClosed ) { case 0 : edge = IntervalEdge . CLOSED ; break ; case 1 : edge = IntervalEdge . OPEN ; break ; default : throw new StreamCorruptedException ( "Invalid edge state." ) ; } Object t = in . readObject ( ) ; return Boundary . of ( edge , t ) ; }
serialization of a single boundary object