databytebuffer.java

来自「High performance DB query」· Java 代码 · 共 507 行

JAVA
507
字号
/* * @(#)$Id: DataByteBuffer.java,v 1.4 2004/07/02 23:59:22 huebsch Exp $ * * Copyright (c) 2001-2004 Regents of the University of California. * All rights reserved. * * This file is distributed under the terms in the attached BERKELEY-LICENSE * file. If you do not find these files, copies can be found by writing to: * Computer Science Division, Database Group, Universite of California, * 617 Soda Hall #1776, Berkeley, CA 94720-1776. Attention: Berkeley License * * Copyright (c) 2003-2004 Intel Corporation. All rights reserved. * * This file is distributed under the terms in the attached INTEL-LICENSE file. * If you do not find these files, copies can be found by writing to: * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, * Berkeley, CA, 94704.  Attention:  Intel License Inquiry. */package util.network.serialization;import java.nio.ByteBuffer;/** * Class DataByteBuffer * */public class DataByteBuffer implements GenericByteBuffer {    public ByteBuffer theBuffer;    /**     * Constructor DataByteBuffer     *     * @param theBuffer     */    public DataByteBuffer(ByteBuffer theBuffer) {        this.theBuffer = theBuffer;    }    /**     * Method compact     * @return     */    public GenericByteBuffer compact() {        theBuffer.compact();        return this;    }    /**     * Method compareTo     *     * @param ob     * @return     */    public int compareTo(Object ob) {        return (theBuffer.compareTo(((DataByteBuffer) ob).theBuffer));    }    /**     * Method duplicate     * @return     */    public GenericByteBuffer duplicate() {        return new DataByteBuffer(theBuffer.duplicate());    }    /**     * Method get     * @return     */    public byte get() {        return theBuffer.get();    }    /**     * Method get     *     * @param dst     * @return     */    public GenericByteBuffer get(byte[] dst) {        theBuffer.get(dst);        return this;    }    /**     * Method get     *     * @param dst     * @param offset     * @param length     * @return     */    public GenericByteBuffer get(byte[] dst, int offset, int length) {        theBuffer.get(dst, offset, length);        return this;    }    /**     * Method get     *     * @param index     * @return     */    public byte get(int index) {        return theBuffer.get(index);    }    /**     * Method getChar     * @return     */    public char getChar() {        return theBuffer.getChar();    }    /**     * Method getChar     *     * @param index     * @return     */    public char getChar(int index) {        return theBuffer.getChar(index);    }    /**     * Method getDouble     * @return     */    public double getDouble() {        return theBuffer.getDouble();    }    /**     * Method getDouble     *     * @param index     * @return     */    public double getDouble(int index) {        return theBuffer.getDouble(index);    }    /**     * Method getFloat     * @return     */    public float getFloat() {        return theBuffer.getFloat();    }    /**     * Method getFloat     *     * @param index     * @return     */    public float getFloat(int index) {        return theBuffer.getFloat(index);    }    /**     * Method getInt     * @return     */    public int getInt() {        return theBuffer.getInt();    }    /**     * Method getInt     *     * @param index     * @return     */    public int getInt(int index) {        return theBuffer.getInt(index);    }    /**     * Method getLong     * @return     */    public long getLong() {        return theBuffer.getLong();    }    /**     * Method getLong     *     * @param index     * @return     */    public long getLong(int index) {        return theBuffer.getLong(index);    }    /**     * Method getShort     * @return     */    public short getShort() {        return theBuffer.getShort();    }    /**     * Method getShort     *     * @param index     * @return     */    public short getShort(int index) {        return theBuffer.getShort(index);    }    /**     * Method isDirect     * @return     */    public boolean isDirect() {        return theBuffer.isDirect();    }    /**     * Method put     *     * @param b     * @return     */    public GenericByteBuffer put(byte b) {        theBuffer.put(b);        return this;    }    /**     * Method put     *     * @param b     * @return     */    public GenericByteBuffer put(byte b[]) {        theBuffer.put(b);        return this;    }    /**     * Method put     *     * @param src     * @param offset     * @param length     * @return     */    public GenericByteBuffer put(byte[] src, int offset, int length) {        theBuffer.put(src, offset, length);        return this;    }    /**     * Method put     *     * @param src     * @return     */    public GenericByteBuffer put(GenericByteBuffer src) {        theBuffer.put(((DataByteBuffer) src).theBuffer);        return this;    }    /**     * Method put     *     * @param index     * @param b     * @return     */    public GenericByteBuffer put(int index, byte b) {        theBuffer.put(index, b);        return this;    }    /**     * Method putChar     *     * @param value     * @return     */    public GenericByteBuffer putChar(char value) {        theBuffer.putChar(value);        return this;    }    /**     * Method putChar     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putChar(int index, char value) {        theBuffer.putChar(index, value);        return this;    }    /**     * Method putDouble     *     * @param value     * @return     */    public GenericByteBuffer putDouble(double value) {        theBuffer.putDouble(value);        return this;    }    /**     * Method putDouble     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putDouble(int index, double value) {        theBuffer.putDouble(index, value);        return this;    }    /**     * Method putFloat     *     * @param value     * @return     */    public GenericByteBuffer putFloat(float value) {        theBuffer.putFloat(value);        return this;    }    /**     * Method putFloat     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putFloat(int index, float value) {        theBuffer.putFloat(index, value);        return this;    }    /**     * Method putInt     *     * @param value     * @return     */    public GenericByteBuffer putInt(int value) {        theBuffer.putInt(value);        return this;    }    /**     * Method putInt     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putInt(int index, int value) {        theBuffer.putInt(index, value);        return this;    }    /**     * Method putLong     *     * @param value     * @return     */    public GenericByteBuffer putLong(long value) {        theBuffer.putLong(value);        return this;    }    /**     * Method putLong     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putLong(int index, long value) {        theBuffer.putLong(index, value);        return null;    }    /**     * Method putShort     *     * @param value     * @return     */    public GenericByteBuffer putShort(short value) {        theBuffer.putShort(value);        return null;    }    /**     * Method putShort     *     * @param index     * @param value     * @return     */    public GenericByteBuffer putShort(int index, short value) {        theBuffer.putShort(index, value);        return null;    }    /**     * Method slice     * @return     */    public GenericByteBuffer slice() {        return new DataByteBuffer(theBuffer.slice());    }    /**     * Method isReadOnly     * @return     */    public boolean isReadOnly() {        return theBuffer.isReadOnly();    }    /**     * Method capacity     * @return     */    public int capacity() {        return theBuffer.capacity();    }    /**     * Method limit     * @return     */    public int limit() {        return theBuffer.limit();    }    /**     * Method limit     *     * @param newLimit     * @return     */    public GenericByteBuffer limit(int newLimit) {        theBuffer.limit(newLimit);        return this;    }    /**     * Method position     * @return     */    public int position() {        return theBuffer.position();    }    /**     * Method position     *     * @param newPosition     * @return     */    public GenericByteBuffer position(int newPosition) {        theBuffer.position(newPosition);        return this;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?