Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277501

Revisit PathFileObject.getCharContent and friends

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 18
    • Fix Version/s: 19
    • Component/s: tools
    • Labels:
      None

      Description

      PathFileObject.getCharContent reads the input stream into a byte buffer using BaseFileManager.makeByteBuffer. Coding such functionality is not trivial. For example, deciding on whether to read or not, must not solely depend on the result of calling available() on an input stream. To fix this and avoid other possible problems, we could use a method like InputStream.readAllBytes.

      One problem with readAllBytes here is that it returns a byte array. This byte array will either need to be wrapped into a new byte buffer or its contents would need to be transferred into an existing byte buffer.

      Currently an input stream is manually read in a pooled byte buffer.

        Attachments

          Activity

            People

            Assignee:
            prappo Pavel Rappo
            Reporter:
            prappo Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: