Skip to content

JBBPByteOrder may add nativeOrder and inheritOrder #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wjtxyz opened this issue Apr 14, 2020 · 3 comments
Closed

JBBPByteOrder may add nativeOrder and inheritOrder #28

wjtxyz opened this issue Apr 14, 2020 · 3 comments
Assignees

Comments

@wjtxyz
Copy link

wjtxyz commented Apr 14, 2020

JBBPOut use the Object's @bin annotation ByteOrder instead of inherit the ByteOrder from JBBPOut constructor when call JBBPOut.Bin(Object)

example:

`

   byte[] bins = JBBPOut.BeginBin(JBBPByteOrder.LITTLE_ENDIAN).Int(123).Bin(new CommandData(123)).End().toByteArray();
   //actually, bins=[123, 0, 0, 0, 0, 0, 0, 123], but i want bins=[123, 0, 0, 0, 123, 0, 0, 0]

 static class CommandData{
    @Bin(order = 1)
    int data;

    public CommandData(int data) {
        this.data = data;
    }
}

`

@raydac
Copy link
Owner

raydac commented Apr 14, 2020

am I correct that you have @Bin annotated object where directly defined ByteOrder and you want override order provided in @Bin by order provided in JBBPOut?

@raydac raydac self-assigned this Apr 14, 2020
@wjtxyz
Copy link
Author

wjtxyz commented Apr 14, 2020

am I correct that you have @Bin annotated object where directly defined ByteOrder and you want override order provided in @Bin by order provided in JBBPOut?

yes

raydac added a commit that referenced this issue Apr 19, 2020
@raydac
Copy link
Owner

raydac commented Apr 19, 2020

I have added into 2.0.2-SNAPSHOT new method JBBPOut#BinForceByteOrder

@raydac raydac closed this as completed Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants