nio code implementation