Search in sources :

Example 66 with IonException

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

the class ByteBufferTest method testSmallInsertion.

@Test
public void testSmallInsertion() {
    BufferManager buf = new BufferManager();
    IonBinary.Writer writer = buf.openWriter();
    // Write enough data to overflow the first block
    byte[] initialData = new byte[BlockedBuffer._defaultBlockSizeMin + 5];
    // Now insert some stuff at the beginning
    try {
        writer.write(initialData, 0, initialData.length);
        writer.setPosition(0);
        writer.insert(10);
    } catch (IOException e) {
        throw new IonException(e);
    }
}
Also used : IonException(com.amazon.ion.IonException) IOException(java.io.IOException) BufferManager(com.amazon.ion.impl.IonBinary.BufferManager) Test(org.junit.Test)

Aggregations

IonException (com.amazon.ion.IonException)66 IOException (java.io.IOException)31 IonReader (com.amazon.ion.IonReader)10 IonType (com.amazon.ion.IonType)9 SymbolToken (com.amazon.ion.SymbolToken)9 IonValue (com.amazon.ion.IonValue)7 Event (com.amazon.tools.events.Event)7 Test (org.junit.Test)6 IonStruct (com.amazon.ion.IonStruct)5 SymbolTable (com.amazon.ion.SymbolTable)5 SavePoint (com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)5 InputStream (java.io.InputStream)5 ArrayList (java.util.ArrayList)5 EventType (com.amazon.tools.events.EventType)4 IonWriter (com.amazon.ion.IonWriter)3 IonDatagram (com.amazon.ion.IonDatagram)2 IonLob (com.amazon.ion.IonLob)2 Timestamp (com.amazon.ion.Timestamp)2 BufferManager (com.amazon.ion.impl.IonBinary.BufferManager)2 com.amazon.ion.impl._Private_IonWriter (com.amazon.ion.impl._Private_IonWriter)2