Search in sources :

Example 31 with MessageSchema

use of uk.co.real_logic.sbe.xml.MessageSchema in project simple-binary-encoding by real-logic.

the class OtfExample method encodeSchema.

private static void encodeSchema(final ByteBuffer byteBuffer) throws Exception {
    final Path path = Paths.get("src/main/resources/example-schema.xml");
    try (InputStream in = new BufferedInputStream(Files.newInputStream(path))) {
        final MessageSchema schema = XmlSchemaParser.parse(in, ParserOptions.DEFAULT);
        final Ir ir = new IrGenerator().generate(schema);
        try (IrEncoder irEncoder = new IrEncoder(byteBuffer, ir)) {
            irEncoder.encode();
        }
    }
}
Also used : Path(java.nio.file.Path) IrEncoder(uk.co.real_logic.sbe.ir.IrEncoder) IrGenerator(uk.co.real_logic.sbe.xml.IrGenerator) MessageSchema(uk.co.real_logic.sbe.xml.MessageSchema) Ir(uk.co.real_logic.sbe.ir.Ir)

Aggregations

IrGenerator (uk.co.real_logic.sbe.xml.IrGenerator)31 MessageSchema (uk.co.real_logic.sbe.xml.MessageSchema)31 Test (org.junit.Test)25 ByteBuffer (java.nio.ByteBuffer)7 Ir (uk.co.real_logic.sbe.ir.Ir)6 ParserOptions (uk.co.real_logic.sbe.xml.ParserOptions)6 IrEncoder (uk.co.real_logic.sbe.ir.IrEncoder)4 Path (java.nio.file.Path)3 BufferedInputStream (java.io.BufferedInputStream)2 InputStream (java.io.InputStream)2 Before (org.junit.Before)2 StringWriterOutputManager (org.agrona.generation.StringWriterOutputManager)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 IrDecoder (uk.co.real_logic.sbe.ir.IrDecoder)1