private static boolean navigateContextToNextPortableTokenFromPortableField ( PortableNavigatorContext ctx ) throws IOException { BufferObjectDataInput in = ctx . getIn ( ) ; // find the field position that's stored in the fieldDefinition int the context and navigate to it int pos = getStreamPositionOfTheField ( ctx ) ; in . position ( pos ) ; // check if it's null, if so return false indicating that the navigation has failed boolean isNull = in . readBoolean ( ) ; if ( isNull ) { return false ; } // read factory and class ID and validate if it's the same as expected in the fieldDefinition int factoryId = in . readInt ( ) ; int classId = in . readInt ( ) ; int versionId = in . readInt ( ) ; // initialise context with the given portable field for further navigation ctx . advanceContextToNextPortableToken ( factoryId , classId , versionId ) ; return true ; }
returns true if managed to advance false if advance failed due to null field