Java?????????????????
???????????? ???????[ 2016/3/7 10:18:17 ] ??????????????? ???????????
??????д???
????д??????????????????????????д?????????У???????д??????????position???????????д?????????????????????д??????λ???
???????濴?????д?????byte[]???????????
????ByteBuffer buffer = ByteBuffer.allocateDirect(10);
????byte[] data = {1??2};
????buffer.put(data);
????System.out.println("дbyte[]?? " + buffer);
????buffer.clear();
????buffer.put("hello".getBytes());
????System.out.println("дstring?? " + buffer);
??????????????:
????дbyte[]?? java.nio.DirectByteBuffer[pos=2 lim=10 cap=10]
????дstring?? java.nio.DirectByteBuffer[pos=5 lim=10 cap=10]
?????????????????????????byte[]??????ж??????????????????????????????: ??????????JVM?????????????棬?????????ζ??е???????????
????????и??????????????????
????ByteBuffer buffer = ByteBuffer.allocateDirect(10);
????buffer.put(new byte[]{1??2??3??4});
????System.out.println("??д?????? " +buffer);
????buffer.flip();
????System.out.println("flip??? " +buffer);
????byte[] target = new byte[buffer.limit()];
????buffer.get(target);//??????target.length??????
????for(byte b : target){
????System.out.println(b);
????}
????System.out.println("????????? " +buffer);
????????
??????д?????? java.nio.DirectByteBuffer[pos=4 lim=10 cap=10]
????flip??? java.nio.DirectByteBuffer[pos=0 lim=4 cap=10]
????1
????2
????3
????4
????????????? java.nio.DirectByteBuffer[pos=4 lim=4 cap=10]
???????÷???
??????????д?????У??м?????????????
????clear()
??????????????????mark??position??????limit??λ???
????public final Buffer clear() {
????position = 0;
????limit = capacity;
????mark = -1;
????return this;
????}
????flip()
???????????????????????Position?limit???????????????????
????public final Buffer flip() {
????limit = position;
????position = 0;
????mark = -1;
????return this;
????}
????compact()
????????????????????????????????á?
?????????????Position???0?????position+1???1??
????public ByteBuffer compact() {
????int pos = position();
????int lim = limit();
????assert (pos <= lim);
????int rem = (pos <= lim ? lim - pos : 0);
????unsafe.copyMemory(ix(pos)?? ix(0)?? rem << 0);
????position(rem);
????limit(capacity());
????discardMark();
????return this;
????}
??????????ο???????:
????123456789
??????position??λ????2???????compact???????????
????345678989
????isDirect()
????????????????ж???????????檔????????true????????????false??
????rewind()
???????????????????mark????
????public final Buffer rewind() {
????position = 0;
????mark = -1;
????return this;
????}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????