1 Star 0 Fork 2

yxljava/Java8Source

forked from Stefan/Java8Source 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
HeapByteBufferR.java 10.03 KB
一键复制 编辑 原始数据 按行查看 历史
Stefan 提交于 2020-08-11 23:17 +08:00 . 初始化
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
// -- This file was mechanically generated: Do not edit! -- //
package java.nio;
/**
* A read-only HeapByteBuffer. This class extends the corresponding
* read/write class, overriding the mutation methods to throw a {@link
* ReadOnlyBufferException} and overriding the view-buffer methods to return an
* instance of this class rather than of the superclass.
*/
class HeapByteBufferR
extends HeapByteBuffer
{
// For speed these fields are actually declared in X-Buffer;
// these declarations are here as documentation
/*
*/
HeapByteBufferR(int cap, int lim) { // package-private
super(cap, lim);
this.isReadOnly = true;
}
HeapByteBufferR(byte[] buf, int off, int len) { // package-private
super(buf, off, len);
this.isReadOnly = true;
}
protected HeapByteBufferR(byte[] buf,
int mark, int pos, int lim, int cap,
int off)
{
super(buf, mark, pos, lim, cap, off);
this.isReadOnly = true;
}
public ByteBuffer slice() {
return new HeapByteBufferR(hb,
-1,
0,
this.remaining(),
this.remaining(),
this.position() + offset);
}
public ByteBuffer duplicate() {
return new HeapByteBufferR(hb,
this.markValue(),
this.position(),
this.limit(),
this.capacity(),
offset);
}
public ByteBuffer asReadOnlyBuffer() {
return duplicate();
}
public boolean isReadOnly() {
return true;
}
public ByteBuffer put(byte x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer put(int i, byte x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer put(byte[] src, int offset, int length) {
throw new ReadOnlyBufferException();
}
public ByteBuffer put(ByteBuffer src) {
throw new ReadOnlyBufferException();
}
public ByteBuffer compact() {
throw new ReadOnlyBufferException();
}
byte _get(int i) { // package-private
return hb[i];
}
void _put(int i, byte b) { // package-private
throw new ReadOnlyBufferException();
}
// char
public ByteBuffer putChar(char x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putChar(int i, char x) {
throw new ReadOnlyBufferException();
}
public CharBuffer asCharBuffer() {
int size = this.remaining() >> 1;
int off = offset + position();
return (bigEndian
? (CharBuffer)(new ByteBufferAsCharBufferRB(this,
-1,
0,
size,
size,
off))
: (CharBuffer)(new ByteBufferAsCharBufferRL(this,
-1,
0,
size,
size,
off)));
}
// short
public ByteBuffer putShort(short x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putShort(int i, short x) {
throw new ReadOnlyBufferException();
}
public ShortBuffer asShortBuffer() {
int size = this.remaining() >> 1;
int off = offset + position();
return (bigEndian
? (ShortBuffer)(new ByteBufferAsShortBufferRB(this,
-1,
0,
size,
size,
off))
: (ShortBuffer)(new ByteBufferAsShortBufferRL(this,
-1,
0,
size,
size,
off)));
}
// int
public ByteBuffer putInt(int x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putInt(int i, int x) {
throw new ReadOnlyBufferException();
}
public IntBuffer asIntBuffer() {
int size = this.remaining() >> 2;
int off = offset + position();
return (bigEndian
? (IntBuffer)(new ByteBufferAsIntBufferRB(this,
-1,
0,
size,
size,
off))
: (IntBuffer)(new ByteBufferAsIntBufferRL(this,
-1,
0,
size,
size,
off)));
}
// long
public ByteBuffer putLong(long x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putLong(int i, long x) {
throw new ReadOnlyBufferException();
}
public LongBuffer asLongBuffer() {
int size = this.remaining() >> 3;
int off = offset + position();
return (bigEndian
? (LongBuffer)(new ByteBufferAsLongBufferRB(this,
-1,
0,
size,
size,
off))
: (LongBuffer)(new ByteBufferAsLongBufferRL(this,
-1,
0,
size,
size,
off)));
}
// float
public ByteBuffer putFloat(float x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putFloat(int i, float x) {
throw new ReadOnlyBufferException();
}
public FloatBuffer asFloatBuffer() {
int size = this.remaining() >> 2;
int off = offset + position();
return (bigEndian
? (FloatBuffer)(new ByteBufferAsFloatBufferRB(this,
-1,
0,
size,
size,
off))
: (FloatBuffer)(new ByteBufferAsFloatBufferRL(this,
-1,
0,
size,
size,
off)));
}
// double
public ByteBuffer putDouble(double x) {
throw new ReadOnlyBufferException();
}
public ByteBuffer putDouble(int i, double x) {
throw new ReadOnlyBufferException();
}
public DoubleBuffer asDoubleBuffer() {
int size = this.remaining() >> 3;
int off = offset + position();
return (bigEndian
? (DoubleBuffer)(new ByteBufferAsDoubleBufferRB(this,
-1,
0,
size,
size,
off))
: (DoubleBuffer)(new ByteBufferAsDoubleBufferRL(this,
-1,
0,
size,
size,
off)));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yxljava/Java8Source.git
git@gitee.com:yxljava/Java8Source.git
yxljava
Java8Source
Java8Source
master

搜索帮助