nio implementation with API