Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1920 Binary Type
  3. THRIFT-830

Switch binary field implementation from byte[] to ByteBuffer

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • None
    • 0.4
    • None

    Description

      Instead of using byte[] as the implementation for binary fields, let's use ByteBuffer.

      There's nothing that you can do with byte[] that you can't also do with ByteBuffer, and there are more things you can do with ByteBuffer. It opens the way for us to avoid needless buffer copies on serialization and deserialization. It gives us a generally accepted equals() and compareTo() implementation, so we don't have to have custom cases for that anymore.

      Making this change will probably cause more than a little bit of trauma, changing the method signatures in both TProtocol and generated code. It's possible that I could be persuaded to support a command line switch for producing old-style byte[] methods in some contexts, but I'd love not to waste time supporting suboptimal features.

      Attachments

        1. thrift-830.patch
          36 kB
          Bryan Duxbury

        Issue Links

          Activity

            People

              bryanduxbury Bryan Duxbury
              bryanduxbury Bryan Duxbury
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: