Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the source code of java.nio.Buffer

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report