public static Optional < Byte > readMaybeByte ( ByteBuf bf ) { if ( bf . readableBytes ( ) >= 1 ) { return Optional . of ( bf . readByte ( ) ) ; } else { bf . resetReaderIndex ( ) ; return Optional . empty ( ) ; } }
Reads a byte if possible . If not present the reader index is reset to the last mark .