File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed
main/java/uk/co/real_logic/sbe/json
test/java/uk/co/real_logic/sbe/json Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 1- # Fri Jan 16 09:39:48 PST 2015
1+ # Wed Mar 25 15:49:40 GMT 2015
22distributionBase =GRADLE_USER_HOME
33distributionPath =wrapper/dists
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
6- distributionUrl =https\://services.gradle.org/distributions/gradle-2.2-bin .zip
6+ distributionUrl =https\://services.gradle.org/distributions/gradle-2.2-all .zip
Original file line number Diff line number Diff line change 2525import java .util .List ;
2626
2727/**
28- * .
28+ * Pretty Print Json based upon the given Ir .
2929 */
3030public class JsonPrinter {
3131
32+ private final OtfHeaderDecoder headerDecoder ;
3233 private final Ir ir ;
3334
3435 public JsonPrinter (final Ir ir )
3536 {
3637 this .ir = ir ;
38+ headerDecoder = new OtfHeaderDecoder (ir .headerStructure ());
3739 }
3840
3941 public void print (final ByteBuffer encodedMessage , final StringBuilder output )
4042 {
41- // From the IR we can create OTF decoder for message headers.
42- final OtfHeaderDecoder headerDecoder = new OtfHeaderDecoder (ir .headerStructure ());
43-
44- // Now we have IR we can read the message header
4543 int bufferOffset = 0 ;
4644 final UnsafeBuffer buffer = new UnsafeBuffer (encodedMessage );
4745
Original file line number Diff line number Diff line change @@ -46,14 +46,12 @@ public class JsonPrinterTest
4646 @ Test
4747 public void exampleMessagePrintedAsJson () throws Exception
4848 {
49- // Encode up message and schema as if we just got them off the wire.
5049 final ByteBuffer encodedSchemaBuffer = ByteBuffer .allocateDirect (SCHEMA_BUFFER_CAPACITY );
5150 encodeSchema (encodedSchemaBuffer );
5251
5352 final ByteBuffer encodedMsgBuffer = ByteBuffer .allocateDirect (MSG_BUFFER_CAPACITY );
5453 encodeTestMessage (encodedMsgBuffer );
5554
56- // Now lets decode the schema IR so we have IR objects.
5755 encodedSchemaBuffer .flip ();
5856 final Ir ir = decodeIr (encodedSchemaBuffer );
5957
You can’t perform that action at this time.
0 commit comments