Java Code Examples for com.igormaznitsa.jbbp.mapper.Bin#byteOrder()

The following examples show how to use com.igormaznitsa.jbbp.mapper.Bin#byteOrder() . 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: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldFloat(final Object obj, final Field field, final Bin annotation, final float value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.Float(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write float value", ex);
  } finally {
    this.byteOrder = old;
  }
}
 
Example 2
Source File: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldString(final Object obj, final Field field, final Bin annotation, final String value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.String(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write string value", ex);
  } finally {
    this.byteOrder = old;
  }
}
 
Example 3
Source File: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldDouble(final Object obj, final Field field, final Bin annotation, final double value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.Double(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write double value", ex);
  } finally {
    this.byteOrder = old;
  }
}
 
Example 4
Source File: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldLong(final Object obj, final Field field, final Bin annotation, final long value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.Long(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write long value", ex);
  } finally {
    this.byteOrder = old;
  }
}
 
Example 5
Source File: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldInt(final Object obj, final Field field, final Bin annotation, final int value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.Int(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write int value", ex);
  } finally {
    this.byteOrder = old;
  }
}
 
Example 6
Source File: JBBPOut.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFieldShort(final Object obj, final Field field, final Bin annotation, final boolean signed, final int value) {
  final JBBPByteOrder old = this.byteOrder;
  try {
    this.byteOrder = annotation.byteOrder();
    this.Short(value);
  } catch (IOException ex) {
    throw new JBBPIOException("Can't write short value", ex);
  } finally {
    this.byteOrder = old;
  }
}