assert context != null;
String encoded = context.getConfiguration().getRaw(KEY);
if (encoded == null) {
return Collections.emptyList();
}
VariableTable table = getVariableTable(context);
try {
ByteArrayInputStream source = new ByteArrayInputStream(encoded.getBytes(ASCII));
DataInputStream input = new DataInputStream(new GZIPInputStream(new Base64InputStream(source)));
long version = WritableUtils.readVLong(input);
if (version != SERIAL_VERSION) {
throw new IOException(MessageFormat.format(
"Invalid StageOutput version: framework={0}, saw={1}",
SERIAL_VERSION,
version));
}
List<OutputSpec> results = new ArrayList<OutputSpec>();
int specCount = WritableUtils.readVInt(input);
for (int specIndex = 0; specIndex < specCount; specIndex++) {
String basePath = WritableUtils.readString(input);
try {
basePath = table.parse(basePath);
} catch (IllegalArgumentException e) {
throw new IllegalStateException(MessageFormat.format(
"Invalid basePath: {0}",
basePath), e);
}
int patternCount = WritableUtils.readVInt(input);
List<String> patterns = new ArrayList<String>();
for (int patternIndex = 0; patternIndex < patternCount; patternIndex++) {
String pattern = WritableUtils.readString(input);
try {
pattern = table.parse(pattern);
} catch (IllegalArgumentException e) {
throw new IllegalStateException(MessageFormat.format(
"Invalid delete pattern: {0}",
pattern), e);
}