com/smartg/java/vfs/VfsUtil.java
public static String readFile(VFile f) throws IOException {
	StringBuffer sb = new StringBuffer();
	UTF16_DetectInputStream udis = new UTF16_DetectInputStream(f.getInputStream());
	if (udis.isUTF) {
	    byte[] b = new byte[(int) Math.min(Integer.MAX_VALUE, f.length())];
	    readFully(udis, b, 0, b.length);
	    udis.close();
	    return new String(b, "UTF-16");
	}
	BufferedReader reader = new BufferedReader(new InputStreamReader(f.getInputStream()));
	try {
	    readFile(reader, sb);
	} finally {
	    reader.close();
	    udis.close();
	}
	return sb.toString();
    }
/**
     * Read file and return it content as String
     * 
     * @param f
     *            VFile
     * @return String
     * @throws IOException
     */
Read file and return it content as String

@param f
VFile
@return String
@throws IOException
Read file and return it content as String @param f VFile @return String @throws IOException
public static String readFile(VFile f) throws IOException {
	StringBuffer sb = new StringBuffer();
	UTF16_DetectInputStream udis = new UTF16_DetectInputStream(f.getInputStream());
	if (udis.isUTF) {
	    byte[] b = new byte[(int) Math.min(Integer.MAX_VALUE, f.length())];
	    readFully(udis, b, 0, b.length);
	    udis.close();
	    return new String(b, "UTF-16");
	}
	BufferedReader reader = new BufferedReader(new InputStreamReader(f.getInputStream()));
	try {
	    readFile(reader, sb);
	} finally {
	    reader.close();
	    udis.close();
	}
	return sb.toString();
    }
public static String readFile ( VFile f ) throws IOException { StringBuffer sb = new StringBuffer ( ) ; UTF16_DetectInputStream udis = new UTF16_DetectInputStream ( f . getInputStream ( ) ) ; if ( udis . isUTF ) { byte [ ] b = new byte [ ( int ) Math . min ( Integer . MAX_VALUE , f . length ( ) ) ] ; readFully ( udis , b , 0 , b . length ) ; udis . close ( ) ; return new String ( b , "UTF-16" ) ; } BufferedReader reader = new BufferedReader ( new InputStreamReader ( f . getInputStream ( ) ) ) ; try { readFile ( reader , sb ) ; } finally { reader . close ( ) ; udis . close ( ) ; } return sb . toString ( ) ; }
Read file and return it content as String
Read file and return it content as String