func hasBytesAvailable()

in Sources/Instrumentation/WKWebView/BodyCache/StreamingMultipartFormData.swift [418:448]


    func hasBytesAvailable() -> Bool {
        // Allows `read:maxLength:` to be called again if `OTelJSBridgeMultipartFormFinalBoundary` doesn't fit into the available buffer
        if phase == .FinalBoundaryPhase {
            return true
        }

        guard let inputStream = self.inputStream else {
            return false
        }

        switch inputStream.streamStatus {
        case Stream.Status.notOpen:
            fallthrough
        case Stream.Status.opening:
            fallthrough
        case Stream.Status.open:
            fallthrough
        case Stream.Status.reading:
            fallthrough
        case Stream.Status.writing:
            return true
        case Stream.Status.atEnd:
            fallthrough
        case Stream.Status.closed:
            fallthrough
        case Stream.Status.error:
            fallthrough
        default:
            return false
        }
    }