⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 request.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                bytes_[offset_++] = (byte) (overrideLid & 0xff);                bytes_[offset_++] = (byte) ((lidAndLengthOverrides[offset][1] >>> 8) & 0xff);                bytes_[offset_++] = (byte) (lidAndLengthOverrides[offset][1] & 0xff);            }        }    }// perf end    // insert a big endian unsigned 2 byte value into the buffer.    final void write2Bytes(int value) {        ensureLength(offset_ + 2);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a big endian unsigned 4 byte value into the buffer.    final void write4Bytes(long value) {        ensureLength(offset_ + 4);        bytes_[offset_++] = (byte) ((value >>> 24) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 16) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // copy length number of bytes starting at offset 0 of the byte array, buf,    // into the buffer.  it is up to the caller to make sure buf has at least length    // number of elements.  no checking will be done by this method.    final void writeBytes(byte[] buf, int length) {        ensureLength(offset_ + length);        System.arraycopy(buf, 0, bytes_, offset_, length);        offset_ += length;    }    final void writeBytes(byte[] buf) {        ensureLength(offset_ + buf.length);        System.arraycopy(buf, 0, bytes_, offset_, buf.length);        offset_ += buf.length;    }    // insert a pair of unsigned 2 byte values into the buffer.    final void writeCodePoint4Bytes(int codePoint, int value) {                                                      // should this be writeCodePoint2Bytes        ensureLength(offset_ + 4);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a 4 byte length/codepoint pair and a 1 byte unsigned value into the buffer.    // total of 5 bytes inserted in buffer.    protected final void writeScalar1Byte(int codePoint, int value) {        ensureLength(offset_ + 5);        bytes_[offset_++] = 0x00;        bytes_[offset_++] = 0x05;        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a 4 byte length/codepoint pair and a 2 byte unsigned value into the buffer.    // total of 6 bytes inserted in buffer.    final void writeScalar2Bytes(int codePoint, int value) {        ensureLength(offset_ + 6);        bytes_[offset_++] = 0x00;        bytes_[offset_++] = 0x06;        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a 4 byte length/codepoint pair and a 4 byte unsigned value into the    // buffer.  total of 8 bytes inserted in the buffer.    protected final void writeScalar4Bytes(int codePoint, long value) {        ensureLength(offset_ + 8);        bytes_[offset_++] = 0x00;        bytes_[offset_++] = 0x08;        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        bytes_[offset_++] = (byte) ((value >>> 24) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 16) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a 4 byte length/codepoint pair and a 8 byte unsigned value into the    // buffer.  total of 12 bytes inserted in the buffer.    final void writeScalar8Bytes(int codePoint, long value) {        ensureLength(offset_ + 12);        bytes_[offset_++] = 0x00;        bytes_[offset_++] = 0x0C;        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        bytes_[offset_++] = (byte) ((value >>> 56) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 48) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 40) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 32) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 24) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 16) & 0xff);        bytes_[offset_++] = (byte) ((value >>> 8) & 0xff);        bytes_[offset_++] = (byte) (value & 0xff);    }    // insert a 4 byte length/codepoint pair into the buffer.    // total of 4 bytes inserted in buffer.    // Note: the length value inserted in the buffer is the same as the value    // passed in as an argument (this value is NOT incremented by 4 before being    // inserted).    final void writeLengthCodePoint(int length, int codePoint) {        ensureLength(offset_ + 4);        bytes_[offset_++] = (byte) ((length >>> 8) & 0xff);        bytes_[offset_++] = (byte) (length & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);    }    final byte[] writeEXTDTALengthCodePointForEncryption(int length, int codePoint) {        //how to encure length and offset later?        byte[] clearedBytes = new byte[4];        clearedBytes[0] = (byte) ((length >>> 8) & 0xff);        clearedBytes[1] = (byte) (length & 0xff);        clearedBytes[2] = (byte) ((codePoint >>> 8) & 0xff);        clearedBytes[3] = (byte) (codePoint & 0xff);        return clearedBytes;    }    // insert a 4 byte length/codepoint pair into the buffer followed    // by length number of bytes copied from array buf starting at offset 0.    // the length of this scalar must not exceed the max for the two byte length    // field.  This method does not support extended length.  The length    // value inserted in the buffer includes the number of bytes to copy plus    // the size of the llcp (or length + 4). It is up to the caller to make sure    // the array, buf, contains at least length number of bytes.    final void writeScalarBytes(int codePoint, byte[] buf, int length) {        ensureLength(offset_ + length + 4);        bytes_[offset_++] = (byte) (((length + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((length + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        for (int i = 0; i < length; i++) {            bytes_[offset_++] = buf[i];        }    }    // insert a 4 byte length/codepoint pair into the buffer.    // total of 4 bytes inserted in buffer.    // Note: datalength will be incremented by the size of the llcp, 4,    // before being inserted.    final void writeScalarHeader(int codePoint, int dataLength) {        ensureLength(offset_ + dataLength + 4);        bytes_[offset_++] = (byte) (((dataLength + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((dataLength + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);    }    // insert a 4 byte length/codepoint pair plus ddm character data into    // the buffer.  This method assumes that the String argument can be    // converted by the ccsid manager.  This should be fine because usually    // there are restrictions on the characters which can be used for ddm    // character data. This method also assumes that the string.length() will    // be the number of bytes following the conversion.    // The two byte length field will contain the length of the character data    // and the length of the 4 byte llcp.  This method does not handle    // scenarios which require extended length bytes.    final void writeScalarString(int codePoint, String string) throws SqlException {        int stringLength = string.length();        ensureLength(offset_ + stringLength + 4);        bytes_[offset_++] = (byte) (((stringLength + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((stringLength + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        offset_ = ccsidManager_.convertFromUCS2(string, bytes_, offset_, netAgent_);    }    // insert a 4 byte length/codepoint pair plus ddm character data into the    // buffer.  The ddm character data is padded if needed with the ccsid manager's    // space character if the length of the character data is less than paddedLength.    // Note: this method is not to be used for String truncation and the string length    // must be <= paddedLength.    // This method assumes that the String argument can be    // converted by the ccsid manager.  This should be fine because usually    // there are restrictions on the characters which can be used for ddm    // character data. This method also assumes that the string.length() will    // be the number of bytes following the conversion.  The two byte length field    // of the llcp will contain the length of the character data including the pad    // and the length of the llcp or 4.  This method will not handle extended length    // scenarios.    final void writeScalarPaddedString(int codePoint, String string, int paddedLength) throws SqlException {        int stringLength = string.length();        ensureLength(offset_ + paddedLength + 4);        bytes_[offset_++] = (byte) (((paddedLength + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((paddedLength + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        offset_ = ccsidManager_.convertFromUCS2(string, bytes_, offset_, netAgent_);        for (int i = 0; i < paddedLength - stringLength; i++) {            bytes_[offset_++] = ccsidManager_.space_;        }    }    // this method inserts ddm character data into the buffer and pad's the    // data with the ccsid manager's space character if the character data length    // is less than paddedLength.    // Not: this method is not to be used for String truncation and the string length    // must be <= paddedLength.    // This method assumes that the String argument can be    // converted by the ccsid manager.  This should be fine because usually    // there are restrictions on the characters which can be used for ddm    // character data. This method also assumes that the string.length() will    // be the number of bytes following the conversion.    final void writeScalarPaddedString(String string, int paddedLength) throws SqlException {        int stringLength = string.length();        ensureLength(offset_ + paddedLength);        offset_ = ccsidManager_.convertFromUCS2(string, bytes_, offset_, netAgent_);        for (int i = 0; i < paddedLength - stringLength; i++) {            bytes_[offset_++] = ccsidManager_.space_;        }    }    // this method writes a 4 byte length/codepoint pair plus the bytes contained    // in array buff to the buffer.    // the 2 length bytes in the llcp will contain the length of the data plus    // the length of the llcp.  This method does not handle scenarios which    // require extended length bytes.    final void writeScalarBytes(int codePoint, byte[] buff) {        int buffLength = buff.length;        ensureLength(offset_ + buffLength + 4);        bytes_[offset_++] = (byte) (((buffLength + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((buffLength + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        System.arraycopy(buff, 0, bytes_, offset_, buffLength);        offset_ += buffLength;    }    // this method inserts a 4 byte length/codepoint pair plus length number of bytes    // from array buff starting at offset start.    // Note: no checking will be done on the values of start and length with respect    // the actual length of the byte array.  The caller must provide the correct    // values so an array index out of bounds exception does not occur.    // the length will contain the length of the data plus the length of the llcp.    // This method does not handle scenarios which require extended length bytes.    final void writeScalarBytes(int codePoint, byte[] buff, int start, int length) {        ensureLength(offset_ + length + 4);        bytes_[offset_++] = (byte) (((length + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((length + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        System.arraycopy(buff, start, bytes_, offset_, length);        offset_ += length;    }    // insert a 4 byte length/codepoint pair plus ddm binary data into the    // buffer.  The binary data is padded if needed with the padByte    // if the data is less than paddedLength.    // Note: this method is not to be used for truncation and buff.length    // must be <= paddedLength.    // The llcp length bytes will contain the length of the data plus    // the length of the llcp or 4.    // This method does not handle scenarios which require extended length bytes.    final void writeScalarPaddedBytes(int codePoint, byte[] buff, int paddedLength, byte padByte) {        int buffLength = buff.length;        ensureLength(offset_ + paddedLength + 4);        bytes_[offset_++] = (byte) (((paddedLength + 4) >>> 8) & 0xff);        bytes_[offset_++] = (byte) ((paddedLength + 4) & 0xff);        bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);        bytes_[offset_++] = (byte) (codePoint & 0xff);        System.arraycopy(buff, 0, bytes_, offset_, buffLength);        offset_ += buffLength;        for (int i = 0; i < paddedLength - buffLength; i++) {            bytes_[offset_++] = padByte;        }

⌨️ 快捷键说明

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