What is the source code of java.nio.Buffer
This article mainly introduces "java.nio.Buffer source code is what", in daily operation, I believe many people in java.nio.Buffer source code is what the problem is there are doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer everyone "java.nio.Buffer source code is what" doubts helpful! Next, please follow the small series to learn together!
Version: JDK7
package java.nio;
public abstract class Buffer {
// mark limit) || (newPosition
< 0)) throw new IllegalArgumentException(); position = newPosition; if (mark >position) mark = -1; return this;}public final int limit() { return limit;}//Reset limit value: if new limit is less than position, set position to new limitpublic final Buffer limit(int newLimit) { if ((newLimit > capacity) || (newLimit
< 0)) throw new IllegalArgumentException(); limit = newLimit; if (position >limit) position = limit; if (mark > limit) mark = -1; return this;}//public final Buffer mark() { mark = position; return this;}//Set position to market public final Buffer reset() { int m = mark; if (m < 0) throw new InvalidMarkException(); position = m; return this;}//Empty buffer: Buffer properties return to initialization state. Note: The data in the buffer is still present. public final Buffer clear() { position = 0; limit = capacity; mark = -1; return this;}//Set limit to current position, then reset position to 0public final Buffer flip() { limit = position; position = 0; mark = -1; return this;}//Set position to 0 and unset the flag: read Buffer public final Buffer rewind() { position = 0; mark = -1; return this;}//return the remaining free space public final int remaining() { return limit - position;}//determine if there are elements in the buffer public final boolean hasRemaining() { return position < limit;}public abstract boolean isReadOnly();public abstract boolean hasArray();public abstract Object array();public abstract int arrayOffset();public abstract boolean isDirect();// -- Package-private methods for bounds checking, etc. --// ...
}
At this point, the study of "java.nio.Buffer source code is what" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!