mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
fix available() == 0 for SSL streams
This commit is contained in:
parent
25423c6bb8
commit
850d990264
@ -642,17 +642,13 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings( "resource" )
|
@SuppressWarnings( "resource" )
|
||||||
public static String readStream( InputStream input ) throws IOException {
|
public static String readStream( InputStream input ) throws IOException {
|
||||||
if( input.available() > 0 ) {
|
|
||||||
byte[] bytes = new byte[8192];
|
byte[] bytes = new byte[8192];
|
||||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
while( input.available() > 0 ) {
|
int count;
|
||||||
int count = input.read( bytes );
|
while( (count = input.read( bytes )) > 0 ) {
|
||||||
stream.write( bytes, 0, count );
|
stream.write( bytes, 0, count );
|
||||||
}
|
}
|
||||||
return new String( stream.toByteArray() );
|
return new String( stream.toByteArray() );
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user