Changeset 685


Ignore:
Timestamp:
08/05/10 18:59:07 (18 months ago)
Author:
octorian
Message:

Fix for InputStream.available() returning zero when more data needs to be read to form a complete line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LogicMail/src/org/logicprobe/LogicMail/util/Connection.java

    r680 r685  
    410410                 
    411411                bytesAvailable = input.available(); 
     412 
     413                // If no bytes are reported as being available, but we have 
     414                // not yet received a full line, then we need to attempt 
     415                // another single-byte blocking read. 
     416                if(bytesAvailable == 0) { 
     417                    firstByte = input.read(); 
     418                    byteStream.write((byte)firstByte); 
     419                    bytesReceived++; 
     420                    bytesAvailable = input.available(); 
     421                } 
    412422            } 
    413423        } 
Note: See TracChangeset for help on using the changeset viewer.