Package com.fineqt.fpb.lib.api

Examples of com.fineqt.fpb.lib.api.IValue


            IContainerValue msgValue = (IContainerValue)value;
            //取得Content-Length首部字段
            @SuppressWarnings("unchecked")
            IListValue<IRecordSetValue> headers = (IListValue<IRecordSetValue>)
                    msgValue.getField(HTTP_MESSAGE__HEADERS);
            IValue contentLengthValue = null;
            if (headers != null) {
                for (int i = 0; i < headers.getLength(); i++) {
                    IRecordSetValue header = headers.getItem(i);
                    if (header == null) {
                        continue;                           
                    }
                    IValue name = header.getField(HTTP_HEADER__NAME);
                    if (name == null) {
                        continue;
                    }
                    if (HeaderNames.CONTENT_LENGTH.equals(name.getText())) {
                        contentLengthValue = header.getField(HTTP_HEADER__VALUE);
                    }
                }
            }
            //根据httpBody/data来更新
View Full Code Here


        }

        private void updateChunkLength(PValue value) {
            IContainerValue chunkValue = (IContainerValue)value;
            //取得chunkLength字段
            IValue chunkLength = null;
            IContainerValue lengthLine = (IContainerValue)chunkValue.getField(
                    HTTP_CHUNK__LENGTH_LINE);
            if (lengthLine != null) {
                chunkLength = lengthLine.getField(HTTP_CHUNK_LENGTH_LINE__CHUNK_LENGTH);
            }
            //根据chunkData/data来更新
            if (chunkLength != null) {
                IContainerValue chunkData = (IContainerValue)chunkValue.getField(
                        HTTP_CHUNK__CHUNK_DATA);
                //默认为0
                String text = "0";
                if (chunkData != null && !chunkData.notPresent()) {
                    IOctetstringValue data = (IOctetstringValue)chunkData.getField(
                            HTTP_CHUNK_DATA__DATA);
                    if (data != null) {
                        text = Integer.toString(data.getLength());
                    }
                }
                chunkLength.setText(text);
            }
        }
View Full Code Here

                DecodeParameters paras, DecodeResult result) throws DecodeException {
            DecodeResult ret = super.postDecode(cxt, input, paras, result);
            if (ret.getValue() != null) {
                //设置chunkLength
                IContainerValue value = (IContainerValue)ret.getValue();
                IValue lenValue = value.getField(HTTP_CHUNK_LENGTH_LINE__CHUNK_LENGTH);
                IIntegerValue intValue = (IIntegerValue)cxt.getFieldStackMap().peekField(
                        StackFields.CHUNK_LENGTH);
                if (intValue == null) {
                    intValue = getPModule().getFactory().createInteger();
                    cxt.getFieldStackMap().setTopField(StackFields.CHUNK_LENGTH, intValue);
                }
                try {
                    intValue.setInteger(Integer.parseInt(lenValue.getText(), 16));
                } catch (NumberFormatException e) {
                    //有错误时认为是0
                    intValue.setInteger(0);
                }
            }
View Full Code Here

    @Override
    protected boolean postDecodeItem(DecodeContext cxt, IBitBuffer input, DecodeParameters paras,
        DecodeResult parentResult, DecodeResult itemResult, PListItemExt itemMeta) {
      if (itemResult.getValue() != null ) {
        IUnionValue listItem = (IUnionValue)itemResult.getValue();
        IValue variant = listItem.getPresentVariant();
        //遇到LastOption后停止列表余下项目的解码
        if (variant != null && variant.getType().getID() == LAST_OPTION) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

TOP

Related Classes of com.fineqt.fpb.lib.api.IValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.