public static String decodeString(InputStream stream) throws IOException {
		byte[] completeBuffer = new byte[0];
		final byte[] buffer = new byte[BUFFER_SIZE];
		int read;
		while ((read = stream.read(buffer)) > 0) {
			final byte[] tmp = new byte[completeBuffer.length + read];
			System.arraycopy(completeBuffer, 0, tmp, 0, completeBuffer.length);
			System.arraycopy(buffer, 0, tmp, completeBuffer.length, read);
			completeBuffer = tmp;
		}
		return decodeString(completeBuffer);
	}
public static String decodeString ( InputStream stream ) throws IOException { byte [ ] completeBuffer = new byte [ 0 ] ; final byte [ ] buffer = new byte [ BUFFER_SIZE ] ; int read ; while ( ( read = stream . read ( buffer ) ) > 0 ) { final byte [ ] tmp = new byte [ completeBuffer . length + read ] ; System . arraycopy ( completeBuffer , 0 , tmp , 0 , completeBuffer . length ) ; System . arraycopy ( buffer , 0 , tmp , completeBuffer . length , read ) ; completeBuffer = tmp ; } return decodeString ( completeBuffer ) ; }
Decode the bytes from the specified input stream
according to a charset selection. This function tries
to decode a string from the given byte array
with the following charsets (in preferred order):
<ul>
<li>the current charset returned by {@link Charset#defaultCharset()},</li>
<li>OEM United States: IBM437,</li>
<li>West European: ISO-8859-1,</li>
<li>one of the charst returned by {@link Charset#availableCharsets()}.</li>
</ul>

<p>The IBM437 charset was added to support several specific files (Dbase files)
generated from a GIS.

@param stream is the stream to decode.
@return the decoded string with the appropriate charset set.
@throws IOException when the stream cannot be read.