Search in sources :

Example 46 with SymbolToken

use of com.amazon.ion.SymbolToken in project ion-java by amzn.

the class IonReaderTextUserX method getFieldNameSymbol.

@Override
public final SymbolToken getFieldNameSymbol() {
    SymbolToken fieldName = super.getFieldNameSymbol();
    validateSymbolToken(fieldName);
    return fieldName;
}
Also used : SymbolToken(com.amazon.ion.SymbolToken)

Example 47 with SymbolToken

use of com.amazon.ion.SymbolToken in project ion-java by amzn.

the class IonWriterSystem method internAnnotationsAndGetSids.

final int[] internAnnotationsAndGetSids() throws IOException {
    int count = _annotation_count;
    if (count == 0)
        return _Private_Utils.EMPTY_INT_ARRAY;
    int[] sids = new int[count];
    for (int i = 0; i < count; i++) {
        SymbolToken sym = _annotations[i];
        int sid = sym.getSid();
        if (sid == UNKNOWN_SYMBOL_ID) {
            String text = sym.getText();
            sid = add_symbol(text);
            _annotations[i] = new SymbolTokenImpl(text, sid);
        }
        sids[i] = sid;
    }
    return sids;
}
Also used : SymbolToken(com.amazon.ion.SymbolToken) com.amazon.ion.impl._Private_Utils.newSymbolToken(com.amazon.ion.impl._Private_Utils.newSymbolToken)

Example 48 with SymbolToken

use of com.amazon.ion.SymbolToken in project ion-java by amzn.

the class IonWriterSystem method addTypeAnnotation.

public final void addTypeAnnotation(String annotation) {
    SymbolToken is = newSymbolToken(getSymbolTable(), annotation);
    ensureAnnotationCapacity(_annotation_count + 1);
    _annotations[_annotation_count++] = is;
}
Also used : SymbolToken(com.amazon.ion.SymbolToken) com.amazon.ion.impl._Private_Utils.newSymbolToken(com.amazon.ion.impl._Private_Utils.newSymbolToken)

Example 49 with SymbolToken

use of com.amazon.ion.SymbolToken in project ion-java by amzn.

the class IonWriterSystemText method startValue.

@Override
void startValue() throws IOException {
    super.startValue();
    boolean followingLongString = _following_long_string;
    followingLongString = writeSeparator(followingLongString);
    // write field name
    if (_in_struct) {
        SymbolToken sym = assumeFieldNameSymbol();
        writeFieldNameToken(sym);
        _output.appendAscii(':');
        clearFieldName();
        followingLongString = false;
    }
    // writing an IVM
    if (hasAnnotations() && !_is_writing_ivm) {
        if (!_options._skip_annotations) {
            SymbolToken[] annotations = getTypeAnnotationSymbols();
            writeAnnotations(annotations);
            followingLongString = false;
        }
        clearAnnotations();
    }
    _following_long_string = followingLongString;
}
Also used : SymbolToken(com.amazon.ion.SymbolToken)

Example 50 with SymbolToken

use of com.amazon.ion.SymbolToken in project ion-java by amzn.

the class IonReaderTextRawX method append_annotation.

private final void append_annotation(SymbolToken sym) {
    // empty text is checked by caller
    int oldlen = _annotations.length;
    if (_annotation_count >= oldlen) {
        int newlen = oldlen * 2;
        SymbolToken[] temp = new SymbolToken[newlen];
        System.arraycopy(_annotations, 0, temp, 0, oldlen);
        _annotations = temp;
    }
    _annotations[_annotation_count++] = sym;
}
Also used : SymbolToken(com.amazon.ion.SymbolToken) SavePoint(com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)

Aggregations

SymbolToken (com.amazon.ion.SymbolToken)68 SymbolTable (com.amazon.ion.SymbolTable)14 com.amazon.ion.impl._Private_Utils.newSymbolToken (com.amazon.ion.impl._Private_Utils.newSymbolToken)13 IonType (com.amazon.ion.IonType)10 IonValue (com.amazon.ion.IonValue)10 IonException (com.amazon.ion.IonException)9 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)6 IonStruct (com.amazon.ion.IonStruct)4 IOException (java.io.IOException)4 Event (com.amazon.tools.events.Event)3 EventType (com.amazon.tools.events.EventType)3 FakeSymbolToken (com.amazon.ion.FakeSymbolToken)2 IonDatagram (com.amazon.ion.IonDatagram)2 IonSequence (com.amazon.ion.IonSequence)2 IonString (com.amazon.ion.IonString)2 UnknownSymbolException (com.amazon.ion.UnknownSymbolException)2 SavePoint (com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)2 ImportDescriptor (com.amazon.tools.events.ImportDescriptor)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2