Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-2936

Use java.nio.ByteBuffer for buffering in DDMWriter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 10.4.1.3
    • Network Server
    • None

    Description

      org.apache.derby.impl.drda.DDMWriter uses a byte array as a buffer. Wrapping the array in a java.nio.ByteBuffer has some advantages, for instance:

      • utility methods for encoding primitive types into the byte array could be used instead of manually encoding the values
      • it allows us to encode strings directly into the buffer (using a CharsetEncoder) without doing an expensive String.getBytes(String encoding) in an intermediate step

      By using a utility class, the code becomes easier to maintain. Also, ByteBuffer allows us to access the backing byte array without going through the ByteBuffer interface, so we still have the possibility to modify the byte array directly in cases where that's more convenient.

      Attachments

        1. derby-2936-4.diff
          5 kB
          Knut Anders Hatlen
        2. derby-2936-3.stat
          0.2 kB
          Knut Anders Hatlen
        3. derby-2936-3.diff
          18 kB
          Knut Anders Hatlen
        4. derby-2936-2.stat
          0.1 kB
          Knut Anders Hatlen
        5. derby-2936-2.diff
          9 kB
          Knut Anders Hatlen
        6. d2936-1.diff
          21 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              knutanders Knut Anders Hatlen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: