Source/CSBackend/Platform/Android/Main/Java/com/chilliworks/chillisource/core/FileUtils.java
/**
	 * Reads the entire contents of a binary file from internal storage. 
	 * The contents are returned as a byte array. Note: This method 
	 * requires the Chilli Source activity to have been created to work.
	 * 
	 * @author Ian Copland
	 * 
	 * @param The filename.
	 * @return The file contents.
	 */
Reads the entire contents of a binary file from internal storage.
The contents are returned as a byte array. Note: This method
requires the Chilli Source activity to have been created to work.

@author Ian Copland

@param The filename.
@return The file contents.
Reads the entire contents of a binary file from internal storage . The contents are returned as a byte array . Note : This method requires the Chilli Source activity to have been created to work . @author Ian Copland @param The filename . @return The file contents .
private static byte[] readFileInternal(String in_filePath)
	{
		byte[] abyOutput = null;
		try
		{
			if (doesFileExistInternal(in_filePath) == true)
			{
				InputStream stream = null;
				try
				{
					File file = CSApplication.get().getAppContext().getFileStreamPath(in_filePath);
					abyOutput = new byte[(int)file.length()];
					stream = new BufferedInputStream(CSApplication.get().getAppContext().openFileInput(in_filePath));
					int dwTotalRead = 0;
					while(dwTotalRead < abyOutput.length)
					{
						int dwRemaining = abyOutput.length - dwTotalRead;
						int dwRead = stream.read(abyOutput, dwTotalRead, dwRemaining); 
						if (dwRead > 0)
						{
							dwTotalRead += dwRead;
						}
					}
				}
		        catch (Exception e)
		        {
		        	throw e;
		        }
				finally
				{
					if (stream != null)
					{
						stream.close();
					}
				}
			}
		}
		catch (Exception e)
		{
			Logging.logError(ExceptionUtils.ConvertToString(e));
		}
		return abyOutput;
	}
private static byte [ ] readFileInternal ( String in_filePath ) { byte [ ] abyOutput = null ; try { if ( doesFileExistInternal ( in_filePath ) == true ) { InputStream stream = null ; try { File file = CSApplication . get ( ) . getAppContext ( ) . getFileStreamPath ( in_filePath ) ; abyOutput = new byte [ ( int ) file . length ( ) ] ; stream = new BufferedInputStream ( CSApplication . get ( ) . getAppContext ( ) . openFileInput ( in_filePath ) ) ; int dwTotalRead = 0 ; while ( dwTotalRead < abyOutput . length ) { int dwRemaining = abyOutput . length - dwTotalRead ; int dwRead = stream . read ( abyOutput , dwTotalRead , dwRemaining ) ; if ( dwRead > 0 ) { dwTotalRead += dwRead ; } } } catch ( Exception e ) { throw e ; } finally { if ( stream != null ) { stream . close ( ) ; } } } } catch ( Exception e ) { Logging . logError ( ExceptionUtils . ConvertToString ( e ) ) ; } return abyOutput ; }
Reads the entire contents of a binary file from internal storage.
Reads the entire contents of a binary file from internal storage .