use of com.amazon.ion.SymbolTable in project ion-java by amzn.
the class IonDatagramLite method getContextForIndex.
@Override
public IonContext getContextForIndex(IonValue element, int index) {
if (index == this._pending_symbol_table_idx) {
SymbolTable symbols = _pending_symbol_table;
_pending_symbol_table = null;
_pending_symbol_table_idx = -1;
return TopLevelContext.wrap(symbols, this);
}
// the preceding elements symbol table is our next
IonValueLite preceding = (index > 0) ? get_child(index - 1) : null;
if (preceding != null && preceding._context != this) {
return preceding._context;
}
// symbol table
return TopLevelContext.wrap(null, this);
}
use of com.amazon.ion.SymbolTable in project ion-java by amzn.
the class IonReaderTextSystemX method resolveAnnotationSymbols.
/**
* Resolve annotations with the current symbol table.
*/
private void resolveAnnotationSymbols(int count) {
SymbolTable symbols = getSymbolTable();
for (int i = 0; i < count; i++) {
SymbolToken sym = _annotations[i];
SymbolToken updated = _Private_Utils.localize(symbols, sym);
if (updated != sym) {
_annotations[i] = updated;
}
}
}
use of com.amazon.ion.SymbolTable in project ion-java by amzn.
the class IonReaderTextSystemX method getFieldName.
@Override
public final String getFieldName() {
// Superclass handles hoisting logic
String text = getRawFieldName();
if (text == null) {
int id = getFieldId();
if (id != SymbolTable.UNKNOWN_SYMBOL_ID) {
SymbolTable symbols = getSymbolTable();
text = symbols.findKnownSymbol(id);
if (text == null) {
throw new UnknownSymbolException(id);
}
}
}
return text;
}
use of com.amazon.ion.SymbolTable in project ion-java by amzn.
the class IonWriterSystemBinary method inject_local_symbol_table.
@Override
final SymbolTable inject_local_symbol_table() throws IOException {
SymbolTable symbols = super.inject_local_symbol_table();
PatchedValues top;
// find the parent
for (top = _patch; top.getParent() != null; top = top.getParent()) {
}
// inject the symbol table; if @_patch is not the top element, then inject
// the symtab before this top-level value begins
super.startValue();
top.injectSymbolTable(symbols, _patch.getParent() != null);
super.endValue();
return symbols;
}
use of com.amazon.ion.SymbolTable in project ion-java by amzn.
the class IonWriterSystemText method writeSymbolAsIs.
@Override
void writeSymbolAsIs(int symbolId) throws IOException {
SymbolTable symtab = getSymbolTable();
String text = symtab.findKnownSymbol(symbolId);
if (text != null) {
writeSymbolAsIs(text);
} else {
startValue();
writeSidLiteral(symbolId);
closeValue();
}
}
Aggregations