public OtpErlangObject read_any ( ) throws OtpErlangDecodeException { // calls one of the above functions, depending on o final int tag = peek1skip_version ( ) ; switch ( tag ) { case OtpExternal . smallIntTag : case OtpExternal . intTag : case OtpExternal . smallBigTag : case OtpExternal . largeBigTag : return new OtpErlangLong ( this ) ; case OtpExternal . atomTag : case OtpExternal . smallAtomUtf8Tag : case OtpExternal . atomUtf8Tag : return new OtpErlangAtom ( this ) ; case OtpExternal . floatTag : case OtpExternal . newFloatTag : return new OtpErlangDouble ( this ) ; case OtpExternal . refTag : case OtpExternal . newRefTag : case OtpExternal . newerRefTag : return new OtpErlangRef ( this ) ; case OtpExternal . mapTag : return new OtpErlangMap ( this ) ; case OtpExternal . portTag : case OtpExternal . newPortTag : return new OtpErlangPort ( this ) ; case OtpExternal . pidTag : case OtpExternal . newPidTag : return new OtpErlangPid ( this ) ; case OtpExternal . stringTag : return new OtpErlangString ( this ) ; case OtpExternal . listTag : case OtpExternal . nilTag : if ( ( flags & DECODE_INT_LISTS_AS_STRINGS ) != 0 ) { final int savePos = getPos ( ) ; try { return new OtpErlangString ( this ) ; } catch ( final OtpErlangDecodeException e ) { } setPos ( savePos ) ; } return new OtpErlangList ( this ) ; case OtpExternal . smallTupleTag : case OtpExternal . largeTupleTag : return new OtpErlangTuple ( this ) ; case OtpExternal . binTag : return new OtpErlangBinary ( this ) ; case OtpExternal . bitBinTag : return new OtpErlangBitstr ( this ) ; case OtpExternal . compressedTag : return read_compressed ( ) ; case OtpExternal . newFunTag : case OtpExternal . funTag : return new OtpErlangFun ( this ) ; case OtpExternal . externalFunTag : return new OtpErlangExternalFun ( this ) ; default : throw new OtpErlangDecodeException ( "Uknown data type: " + tag ) ; } }
Read an arbitrary Erlang term from the stream .