Skip to content

Commit 724aaee

Browse files
committed
refactoring
1 parent 7f37a1f commit 724aaee

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOrder.java

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
public enum JBBPBitOrder {
2525
/**
2626
* Most Significant Bit First means that the most significant bit will arrive first, the 7th bit will be read as the first one.
27+
* Read data wille be presented in reverse format for Java because Java is LSB0.
2728
*/
2829
MSB0,
2930
/**

jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.igormaznitsa.jbbp.io;
1818

19+
import static com.igormaznitsa.jbbp.utils.JBBPUtils.assertNotNull;
20+
1921
import com.igormaznitsa.jbbp.exceptions.JBBPIOException;
2022
import com.igormaznitsa.jbbp.mapper.Bin;
2123
import com.igormaznitsa.jbbp.mapper.BinFieldFilter;
@@ -81,9 +83,9 @@ public class JBBPOut extends AbstractMappedClassFieldObserver {
8183
*/
8284
private JBBPOut(final OutputStream outStream, final JBBPByteOrder byteOrder,
8385
final JBBPBitOrder bitOrder) {
84-
JBBPUtils.assertNotNull(outStream, "Out stream must not be null");
85-
JBBPUtils.assertNotNull(byteOrder, "Byte order must not be null");
86-
JBBPUtils.assertNotNull(bitOrder, "Bit order must not be null");
86+
assertNotNull(outStream, "Out stream must not be null");
87+
assertNotNull(byteOrder, "Byte order must not be null");
88+
assertNotNull(bitOrder, "Bit order must not be null");
8789

8890
this.outStream = outStream instanceof JBBPBitOutputStream ? (JBBPBitOutputStream) outStream :
8991
new JBBPBitOutputStream(outStream, bitOrder);
@@ -190,7 +192,7 @@ public static JBBPOut BeginBin(final JBBPBitOrder bitOrder) {
190192
* @param array an object to be checked for null.
191193
*/
192194
private static void assertArrayNotNull(final Object array) {
193-
JBBPUtils.assertNotNull(array, "Array must not be null");
195+
assertNotNull(array, "Array must not be null");
194196
}
195197

196198
/**
@@ -199,7 +201,7 @@ private static void assertArrayNotNull(final Object array) {
199201
* @param str an object to be checked for null.
200202
*/
201203
private static void assertStringNotNull(final String str) {
202-
JBBPUtils.assertNotNull(str, "String must not be null");
204+
assertNotNull(str, "String must not be null");
203205
}
204206

205207
/**
@@ -269,7 +271,7 @@ public JBBPOut Skip(int numberOfBytes) throws IOException {
269271
*/
270272
public JBBPOut ByteOrder(final JBBPByteOrder value) {
271273
assertNotEnded();
272-
JBBPUtils.assertNotNull(value, "Byte order must not be null");
274+
assertNotNull(value, "Byte order must not be null");
273275
if (this.processCommands) {
274276
this.byteOrder = value;
275277
}
@@ -386,7 +388,7 @@ private void _writeBits(final JBBPBitNumber numberOfBits, final int value) throw
386388
*/
387389
public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int value) throws IOException {
388390
assertNotEnded();
389-
JBBPUtils.assertNotNull(numberOfBits, "Number of bits must not be null");
391+
assertNotNull(numberOfBits, "Number of bits must not be null");
390392
if (this.processCommands) {
391393
_writeBits(numberOfBits, value);
392394
}
@@ -404,7 +406,7 @@ public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int value) throws IO
404406
*/
405407
public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int... value) throws IOException {
406408
assertNotEnded();
407-
JBBPUtils.assertNotNull(value, "Array must not be null");
409+
assertNotNull(value, "Array must not be null");
408410
if (this.processCommands) {
409411
for (final int v : value) {
410412
_writeBits(numberOfBits, v);
@@ -424,7 +426,7 @@ public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int... value) throws
424426
*/
425427
public JBBPOut Bits(final JBBPBitNumber numberOfBits, final byte[] value) throws IOException {
426428
assertNotEnded();
427-
JBBPUtils.assertNotNull(value, "Array must not be null");
429+
assertNotNull(value, "Array must not be null");
428430
if (this.processCommands) {
429431
for (final byte b : value) {
430432
_writeBits(numberOfBits, b);
@@ -958,7 +960,7 @@ public JBBPOut Long(final long... value) throws IOException {
958960
*/
959961
public JBBPOut Var(final JBBPOutVarProcessor processor, final Object... args) throws IOException {
960962
assertNotEnded();
961-
JBBPUtils.assertNotNull(processor, "Var processor must not be null");
963+
assertNotNull(processor, "Var processor must not be null");
962964
if (this.processCommands) {
963965
this.processCommands = processor.processVarOut(this, this.outStream, args);
964966
}

0 commit comments

Comments
 (0)