Small corrections

Generalized status, fixed a NPE and some code corrections
Just refactoring

made some refactoring for simplify code reading
Using MappedByteBuffer

Using MappedByteBuffer instead of simple ByteBuffer for fixing some
BufferUnderflowExceptions