I want to write an enum value and store it to disk by saving a field from it with ByteBuffer.putShort()
and writing that to disk. This enum is basically a field in a file header.
How much space does ByteBuffer.putShort()
occupy?
I want to write an enum value and store it to disk by saving a field from it with ByteBuffer.putShort()
and writing that to disk. This enum is basically a field in a file header.
How much space does ByteBuffer.putShort()
occupy?
As you haven't stated how you're writing it to disk, the question is unanswerable.
If however you're referring to serialization, the answer is 'no', as the enum is basically serialized as its string name plus a tag and some type information.
EDIT According to your comments and edits, you're actually asking whether putShort()
writes 16 bits. That's answered in the documentation, and it has nothing to do with how big an enum is.