I'm still having trouble reading full chunks when chunked encoded.

while (!done) {

        StringBuilder sb = new StringBuilder();
        int bytesRead = 0;
                                                
        while ((bytesRead = inputStream.read(buffer)) != -1) {
                String chunk = new String(buffer, 0, bytesRead);                
                                    
                sb.append(chunk);
                                                        
                ECGLogger.info("startChannelLoop: bytesRead - " + bytesRead);
                if (bytesRead < buffer.length)
                        break;
        }
                                                
        // TODO: Need to check here for multiple messages in the same chunk
        // TODO: Detect if there are buffers for the same chunk
        if (sb.length() > 0) {
                BroadWorksResponse broadworksResponse = BroadWorksResponse
                        .getResponse(sb.toString());
                                                        
                if (broadworksResponse != null)
                        broadworksResponse.fireNextEvent();
        
                sb.setLength(0);
        }
}

Anyone have any thoughts on getting the whole chuck without blocking on
read?



--
View this message in context: 
http://httpcomponents.10934.n7.nabble.com/inputStream-read-blocks-at-end-of-chunk-tp19642p19829.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to