本文整理匯總了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);
}
}
示例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);
}
}
示例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);
}
示例4: IonParser
import software.amazon.ion.IonReader; //導入依賴的package包/類
IonParser(IonReader reader, boolean shouldCloseReader) {
super(Feature.collectDefaults());
this.reader = reader;
this.shouldCloseReader = shouldCloseReader;
}
示例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();
}
示例6: IonParser
import software.amazon.ion.IonReader; //導入依賴的package包/類
public IonParser(IonReader reader, boolean shouldCloseReader) {
super(Feature.collectDefaults());
this.reader = reader;
this.shouldCloseReader = shouldCloseReader;
}