void writeLong ( long value ) throws IOException { if ( value < MIN_FIX_INT ) { // large negative if ( value >= Byte . MIN_VALUE ) { output . writeByte ( SINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value >= Short . MIN_VALUE ) { output . writeByte ( SINT_16 ) ; output . writeShort ( ( short ) value ) ; } else if ( value >= Integer . MIN_VALUE ) { output . writeByte ( SINT_32 ) ; output . writeInt ( ( int ) value ) ; } else { output . writeByte ( SINT_64 ) ; output . writeLong ( value ) ; } } else if ( value < MAX_FIX_INT ) { // in range -64 to 127 output . writeByte ( ( byte ) value ) ; } else { // large positive if ( value < 0xFF ) { output . writeByte ( UINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value < 0xFFFF ) { output . writeByte ( UINT_16 ) ; output . writeShort ( ( short ) value ) ; } else if ( value < 0xFFFFFFFF L ) { output . writeByte ( UINT_32 ) ; output . writeInt ( ( int ) value ) ; } else { output . writeByte ( UINT_64 ) ; output . writeLong ( value ) ; } } }
Writes a MessagePack long .