📄 reply.java
字号:
protected final void startSameIdChainParse() throws org.apache.derby.client.am.DisconnectException { readDssHeader(); netAgent_.clearSvrcod(); } protected final void endOfSameIdChainData() throws org.apache.derby.client.am.DisconnectException { netAgent_.targetTypdef_ = netAgent_.originalTargetTypdef_; netAgent_.targetSqlam_ = netAgent_.orignalTargetSqlam_; if (this.topDdmCollectionStack_ != Reply.EMPTY_STACK) { zThrowSyntaxError("collection stack not empty at end of same id chain parse"); } if (this.dssLength_ != 0) { zThrowSyntaxError("dss length not 0 at end of same id chain parse"); } if (dssIsChainedWithSameID_ == true) { zThrowSyntaxError("dss chained with same id at end of same id chain parse"); } } private final void zThrowSyntaxError(String error) throws org.apache.derby.client.am.DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(agent_, error)); } protected final int peekTotalColumnCount(int tripletLength) throws org.apache.derby.client.am.DisconnectException { int columnCount = 0; int offset = 0; int tripletType = FdocaConstants.CPT_TRIPLET_TYPE; while (tripletType == FdocaConstants.CPT_TRIPLET_TYPE) { columnCount += ((tripletLength - 3) / 3); // Peek ahead for the next triplet's tripletLength and tripletType. // The number of bytes to skip before the next tripletType is tripletLength - 3. ensureBLayerDataInBuffer(tripletLength - 3); offset += (tripletLength - 3); tripletLength = (buffer_[pos_ + offset++] & 0xff); tripletType = (buffer_[pos_ + offset++] & 0xff); // Skip the 1-byte tripletId. offset++; } return columnCount; } private final void peekExtendedLength() throws org.apache.derby.client.am.DisconnectException { peekedNumOfExtendedLenBytes_ = (peekedLength_ - 0x8004); switch (peekedNumOfExtendedLenBytes_) { case 4: // L L C P Extended Length // -->2-bytes<-- --->4-bytes<--- // We are only peeking the length here, the actual pos_ is still before LLCP. We ensured // 4-bytes in peedCodePoint() for the LLCP, and we need to ensure 4-bytes(of LLCP) + the // extended length bytes here. if (longBufferForDecryption_ == null) //we ddon't need to do this if it's data stream encryption { ensureBLayerDataInBuffer(4 + 4); } // The ddmScalarLen_ we peek here does not include the LLCP and the extended length bytes // themselves. So we will add those back to the ddmScalarLen_ so it can be adjusted // correctly in parseLengthAndMatchCodePoint(). (since the adjustLengths() method will // subtract the length from ddmScalarLen_) peekedLength_ = ((buffer_[pos_ + 4] & 0xff) << 24) + ((buffer_[pos_ + 5] & 0xff) << 16) + ((buffer_[pos_ + 6] & 0xff) << 8) + ((buffer_[pos_ + 7] & 0xff) << 0); break; case 0: peekedLength_ = -1; // this ddm is streamed, so set -1 -> length unknown break; default: doSyntaxrmSemantics(CodePoint.SYNERRCD_INCORRECT_EXTENDED_LEN); } } final int readFastUnsignedByte() throws org.apache.derby.client.am.DisconnectException { return (buffer_[pos_++] & 0xff); } final short readFastShort() throws org.apache.derby.client.am.DisconnectException { short s = SignedBinary.getShort(buffer_, pos_); pos_ += 2; return s; } final int readFastUnsignedShort() throws org.apache.derby.client.am.DisconnectException { return ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0); } final int readFastInt() throws org.apache.derby.client.am.DisconnectException { int i = SignedBinary.getInt(buffer_, pos_); pos_ += 4; return i; } final String readFastString(int length) throws org.apache.derby.client.am.DisconnectException { String result = ccsidManager_.convertToUCS2(buffer_, pos_, length); pos_ += length; return result; } final byte[] readFastBytes(int length) throws org.apache.derby.client.am.DisconnectException { byte[] b = new byte[length]; System.arraycopy(buffer_, pos_, b, 0, length); pos_ += length; return b; } protected final int peekFastLength() throws org.apache.derby.client.am.DisconnectException { return (((buffer_[pos_] & 0xff) << 8) + ((buffer_[pos_ + 1] & 0xff) << 0)); } final void skipFastBytes(int length) throws org.apache.derby.client.am.DisconnectException { pos_ += length; } final void readFastIntArray(int[] array) throws org.apache.derby.client.am.DisconnectException { for (int i = 0; i < array.length; i++) { array[i] = SignedBinary.getInt(buffer_, pos_); pos_ += 4; } } final String readFastString(int length, String encoding) throws org.apache.derby.client.am.DisconnectException { String s = null; try { s = new String(buffer_, pos_, length, encoding); } catch (java.io.UnsupportedEncodingException e) { agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(e, agent_, "encoding not supported!!")); } pos_ += length; return s; } final byte[] readFastLDBytes() throws org.apache.derby.client.am.DisconnectException { int len = ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0); if (len == 0) { return null; } byte[] b = new byte[len]; System.arraycopy(buffer_, pos_, b, 0, len); pos_ += len; return b; } final long readFastLong() throws org.apache.derby.client.am.DisconnectException { long l = SignedBinary.getLong(buffer_, pos_); pos_ += 8; return l; } final byte readFastByte() throws org.apache.derby.client.am.DisconnectException { return (byte) (buffer_[pos_++] & 0xff); } final void mark() { currentPos_ = pos_; } // remove and return the top offset value from mark stack. final int popMark() { return currentPos_; } final int getFastSkipSQLCARDrowLength() { return pos_ - popMark(); } // The only difference between this method and the original getData() method is this method // is not doing an ensureALayerDataInBuffer final ByteArrayOutputStream getFastData(ByteArrayOutputStream existingBuffer) throws org.apache.derby.client.am.DisconnectException { boolean readHeader; int copySize; ByteArrayOutputStream baos; // note: an empty baos can yield an allocated and empty byte[] if (existingBuffer != null) { baos = existingBuffer; } else { if (ddmScalarLen_ != -1) { // allocate a stream based on a known amount of data baos = new ByteArrayOutputStream(ddmScalarLen_); } else { // allocate a stream to hold an unknown amount of data baos = new ByteArrayOutputStream(); //isLengthAndNullabilityUnknown = true; } } // set the amount to read for the first segment copySize = dssLength_; // note: has already been adjusted for headers do { // determine if a continuation header needs to be read after the data if (dssIsContinued_) { readHeader = true; } else { readHeader = false; } // read the segment //ensureALayerDataInBuffer (copySize); adjustLengths(copySize); baos.write(buffer_, pos_, copySize); pos_ += copySize; // read the continuation header, if necessary if (readHeader) { readDSSContinuationHeader(); } copySize = dssLength_; } while (readHeader == true); return baos; } // This method is only used to match the codePoint for those class instance variables // that are embedded in other reply messages. final protected void matchCodePoint(int expectedCodePoint) throws org.apache.derby.client.am.DisconnectException { int actualCodePoint = 0; actualCodePoint = peekedCodePoint_; pos_ += 4; if (actualCodePoint != expectedCodePoint) { zThrowSyntaxError("actual code point, " + actualCodePoint + " does not match expected code point, " + expectedCodePoint); } } protected final int peekNumOfColumns() throws org.apache.derby.client.am.DisconnectException { // skip the 4-byte LLCP and any extended length bytes + 1-byte null sqlcagrp null indicator int offset = (4 + peekedNumOfExtendedLenBytes_ + 1); offset = skipSQLDHROW(offset); return SignedBinary.getShort(buffer_, pos_ + offset); } protected final boolean peekForNullSqlcagrp() { // skip the 4-byte LLCP and any extended length bytes int offset = (4 + peekedNumOfExtendedLenBytes_); int nullInd = buffer_[pos_ + offset] & 0xff; return (nullInd == CodePoint.NULLDATA); } private final int skipSQLDHROW(int offset) throws org.apache.derby.client.am.DisconnectException { int sqldhrowgrpNullInd = buffer_[pos_ + offset++] & 0xff; if (sqldhrowgrpNullInd == CodePoint.NULLDATA) { return offset; } offset += 12; // skip sqldrdbnam int stringLength = ((buffer_[pos_ + offset++] & 0xff) << 8) + ((buffer_[pos_ + offset++] & 0xff) << 0); offset += stringLength; // skip sqldschema stringLength = ((buffer_[pos_ + offset++] & 0xff) << 8) + ((buffer_[pos_ + offset++] & 0xff) << 0); offset += stringLength; stringLength = ((buffer_[pos_ + offset++] & 0xff) << 8) + ((buffer_[pos_ + offset++] & 0xff) << 0); offset += stringLength; return offset; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -