Skip to content

Commit f873611

Browse files
cleanup json printer
1 parent 41c62af commit f873611

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jan 16 09:39:48 PST 2015
1+
#Wed Mar 25 15:49:40 GMT 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=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

main/java/uk/co/real_logic/sbe/json/JsonPrinter.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@
2525
import java.util.List;
2626

2727
/**
28-
* .
28+
* Pretty Print Json based upon the given Ir.
2929
*/
3030
public 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

test/java/uk/co/real_logic/sbe/json/JsonPrinterTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)