当前位置: 首页>>代码示例>>Java>>正文


Java IonReader类代码示例

本文整理汇总了Java中software.amazon.ion.IonReader的典型用法代码示例。如果您正苦于以下问题:Java IonReader类的具体用法?Java IonReader怎么用?Java IonReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IonReader类属于software.amazon.ion包,在下文中一共展示了IonReader类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseErrorCode

import software.amazon.ion.IonReader; //导入依赖的package包/类
@Override
public String parseErrorCode(HttpResponse response, JsonContent jsonContents) {
    IonReader reader = ionSystem.newReader(jsonContents.getRawContent());
    try {
        IonType type = reader.next();
        if (type != IonType.STRUCT) {
            throw new SdkClientException(String.format("Can only get error codes from structs (saw %s), request id %s",
                                                       type, getRequestId(response)));
        }

        boolean errorCodeSeen = false;
        String errorCode = null;
        String[] annotations = reader.getTypeAnnotations();
        for (String annotation : annotations) {
            if (annotation.startsWith(TYPE_PREFIX)) {
                if (errorCodeSeen) {
                    throw new SdkClientException(String.format("Multiple error code annotations found for request id %s",
                                                               getRequestId(response)));
                } else {
                    errorCodeSeen = true;
                    errorCode = annotation.substring(TYPE_PREFIX.length());
                }
            }
        }

        return errorCode;
    } finally {
        IoUtils.closeQuietly(reader, log);
    }
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:31,代码来源:IonErrorCodeParser.java

示例2: parseErrorCode

import software.amazon.ion.IonReader; //导入依赖的package包/类
@Override
public String parseErrorCode(HttpResponse response, JsonContent jsonContents) {
    IonReader reader = ionSystem.newReader(jsonContents.getRawContent());
    try {
        IonType type = reader.next();
        if (type != IonType.STRUCT) {
            throw new SdkClientException(String.format("Can only get error codes from structs (saw %s), request id %s", type, getRequestId(response)));
        }

        boolean errorCodeSeen = false;
        String errorCode = null;
        String[] annotations = reader.getTypeAnnotations();
        for (String annotation : annotations) {
            if (annotation.startsWith(TYPE_PREFIX)) {
                if (errorCodeSeen) {
                    throw new SdkClientException(String.format("Multiple error code annotations found for request id %s", getRequestId(response)));
                } else {
                    errorCodeSeen = true;
                    errorCode = annotation.substring(TYPE_PREFIX.length());
                }
            }
        }

        return errorCode;
    } finally {
        IOUtils.closeQuietly(reader, log);
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:29,代码来源:IonErrorCodeParser.java

示例3: doAssert

import software.amazon.ion.IonReader; //导入依赖的package包/类
@Override
protected void doAssert(LoggedRequest request) throws Exception {
    IonReader expected = ION_SYSTEM.newReader(ionEquals);
    IonReader actual = ION_SYSTEM.newReader(request.getBody());
    assertIonReaderEquals(expected, actual);
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:7,代码来源:IonBodyAssertion.java

示例4: IonParser

import software.amazon.ion.IonReader; //导入依赖的package包/类
IonParser(IonReader reader, boolean shouldCloseReader) {
    super(Feature.collectDefaults());
    this.reader = reader;
    this.shouldCloseReader = shouldCloseReader;
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:6,代码来源:IonParser.java

示例5: write

import software.amazon.ion.IonReader; //导入依赖的package包/类
public static void write(String data, IonWriter writer) throws IOException {
    IonReader reader = SYSTEM.newReader(data);
    writer.writeValues(reader);
    writer.close();
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:6,代码来源:IonParserTest.java

示例6: IonParser

import software.amazon.ion.IonReader; //导入依赖的package包/类
public IonParser(IonReader reader, boolean shouldCloseReader) {
    super(Feature.collectDefaults());
    this.reader = reader;
    this.shouldCloseReader = shouldCloseReader;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:6,代码来源:IonParser.java


注:本文中的software.amazon.ion.IonReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。