the origin of the underlying array (if any) and the limit pointer to the former position of the position pointer. Three get() methods are supplied for transferring data out of a NIO buffer. The bulk implementation, rather than performing a "get" in the traditional sense, "puts" the data into a specified array. The "offset" argument supplied to this method refers not to the offset from within the buffer from which to read, nor an offset from the position pointer, but rather the offset from 0 within the target array. Unless using the absolute get() and put() methods, any get() or put() is conducted from the position pointer. Should one need to read from a different position within the underlying array, whilst not adjusting the writing position, the mark() and reset() methods have been supplied. The mark() method effectively stores the position of the position pointer by setting the mark pointer to the position of the position pointer. The reset() method causes the position pointer to move to the mark pointer's position. Upon invocation of the clear() method or the flip() method the mark pointer is discarded. The clear() method does not ensure zero-ing of the buffer, but does return the limit pointer to the upper boundary of the underlying array, and the position pointer to zero. put() and get() operations for NIO buffers are not thread safe. You can only map() a from a up to Integer.MAX_VALUE in size (2GiB); regions beyond this limit can be accessed using an offset greater than zero. Channels Channels (classes implementing the interface ) are designed to provide for bulk data transfers to and from NIO buffers. This is a low-level data transfer mechanism that exists in parallel with the classes of the higher-level I/O library (packages and ). A channel implementation can be obtained from a high-level data transfer class such as , , or , and vice versa. Channels are analogous to "file descriptors" found in Unix-like operating systems. File channels () can use arbitrary buffers but can also establish a buffer directly mapped to file contents using memory-mapped file. They can also interact with file system locks. Similarly, socket channels ( and ) allow for data transfer between sockets and NIO buffers. FileChannel can be used to do a file copy, which is potentially far more efficient than using old read/write with a byte array. The typical code for this is: