Java Code Examples for com.igormaznitsa.jbbp.io.JBBPByteOrder#BIG_ENDIAN
The following examples show how to use
com.igormaznitsa.jbbp.io.JBBPByteOrder#BIG_ENDIAN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomThreeByteIntegerTypeTest.java From java-binary-block-parser with Apache License 2.0 | 5 votes |
private static int readThreeBytesAsInt(final JBBPBitInputStream in, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) throws IOException { final int b0 = in.readByte(); final int b1 = in.readByte(); final int b2 = in.readByte(); final int value = byteOrder == JBBPByteOrder.BIG_ENDIAN ? (b0 << 16) | (b1 << 8) | b2 : (b2 << 16) | (b1 << 8) | b0; return bitOrder == JBBPBitOrder.LSB0 ? value : ((int) JBBPFieldInt.reverseBits(value) >>> 8); }
Example 2
Source File: JBBPFieldTypeParameterContainerTest.java From java-binary-block-parser with Apache License 2.0 | 5 votes |
@Test public void testConstructorAndGetters() { final String name = "name"; final String extra = "extra"; final JBBPFieldTypeParameterContainer params = new JBBPFieldTypeParameterContainer(JBBPByteOrder.BIG_ENDIAN, name, extra); assertSame(name, params.getTypeName()); assertSame(extra, params.getExtraData()); assertEquals(JBBPByteOrder.BIG_ENDIAN, params.getByteOrder()); }
Example 3
Source File: JBBPTextWriter.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
/** * The Default constructor. A StringWriter will be used inside. */ public JBBPTextWriter() { this(new StringWriter(1024), JBBPByteOrder.BIG_ENDIAN, System.getProperty("line.separator"), DEFAULT_RADIX, DEFAULT_VALUE_PREFIX, DEFAULT_FIRST_VALUE_LINE_PREFIX, DEFAULT_COMMENT_PREFIX, DEFAULT_HR_PREFIX, DEFAULT_VALUE_DELIMITER); }
Example 4
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemComment(final String text, final boolean newLine) { super(BinType.UNDEFINED, "_ignored_because_comment_", JBBPByteOrder.BIG_ENDIAN); this.comment = text; this.newLine = newLine; }
Example 5
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemAlign(final String sizeExpression) { super(BinType.UNDEFINED, null, JBBPByteOrder.BIG_ENDIAN); this.sizeExpression = sizeExpression; }
Example 6
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemVal(final String name, final String sizeExpression) { super(BinType.UNDEFINED, assertTextNotNullAndTrimmedNotEmpty(name), JBBPByteOrder.BIG_ENDIAN); this.sizeExpression = assertExpressionChars(assertTextNotNullAndTrimmedNotEmpty(sizeExpression).trim()); }
Example 7
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemResetCounter() { super(BinType.UNDEFINED, null, JBBPByteOrder.BIG_ENDIAN); }
Example 8
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemStructEnd(final boolean endAll) { super(BinType.UNDEFINED, null, JBBPByteOrder.BIG_ENDIAN); this.endAll = endAll; }
Example 9
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
ItemSkip(final String sizeExpression) { super(BinType.UNDEFINED, null, JBBPByteOrder.BIG_ENDIAN); this.sizeExpression = sizeExpression; }
Example 10
Source File: JBBPTextWriterTest.java From java-binary-block-parser with Apache License 2.0 | 4 votes |
private static JBBPTextWriter makeWriter() { return new JBBPTextWriter(new StringWriter(), JBBPByteOrder.BIG_ENDIAN, "\n", 16, "0x", ".", ";", "~", ","); }
Example 11
Source File: JBBPTextWriter.java From java-binary-block-parser with Apache License 2.0 | 2 votes |
/** * Constructor to wrap a writer, * * @param out a writer to be wrapped, must not be null. */ public JBBPTextWriter(final Writer out) { this(out, JBBPByteOrder.BIG_ENDIAN, System.getProperty("line.separator"), DEFAULT_RADIX, DEFAULT_VALUE_PREFIX, DEFAULT_FIRST_VALUE_LINE_PREFIX, DEFAULT_COMMENT_PREFIX, DEFAULT_HR_PREFIX, DEFAULT_VALUE_DELIMITER); }
Example 12
Source File: JBBPTextWriter.java From java-binary-block-parser with Apache License 2.0 | 2 votes |
/** * Auxiliary method allows to build writer over StringWriter with system-depended next line and hex radix. * The Method allows fast instance create. * * @return the text writer instance, must not be null * @since 1.4.0 */ public static JBBPTextWriter makeStrWriter() { final String lineSeparator = System.setProperty("line.separator", "\n"); return new JBBPTextWriter(new StringWriter(), JBBPByteOrder.BIG_ENDIAN, lineSeparator, 16, "0x", ".", ";", "~", ","); }
Example 13
Source File: JBBPDslBuilder.java From java-binary-block-parser with Apache License 2.0 | 2 votes |
/** * Set byte order for next fields * * @param order order, if null then BIG_ENDIAN * @return the builder instance, must not be null */ public JBBPDslBuilder ByteOrder(final JBBPByteOrder order) { this.byteOrder = order == null ? JBBPByteOrder.BIG_ENDIAN : order; return this; }