1.3.2 preparations
This commit is contained in:
parent
14a18fd770
commit
3e50846135
17 changed files with 1929 additions and 1906 deletions
|
|
@ -9,43 +9,56 @@ import java.io.OutputStreamWriter;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
/**
|
||||
* Decsription of a service config
|
||||
*/
|
||||
public class ConfigHelper
|
||||
{
|
||||
public static String getBaseDir( Context ctx )
|
||||
{
|
||||
// get base dir from private file
|
||||
InputStream configInput = null;
|
||||
try
|
||||
{
|
||||
configInput = ctx.openFileInput( "config.dat" );
|
||||
BufferedReader br = new BufferedReader( new InputStreamReader (configInput ) );
|
||||
return br.readLine();
|
||||
}
|
||||
catch( Exception e ) { return null; }
|
||||
finally
|
||||
{
|
||||
if ( configInput != null ) try { configInput.close(); } catch( Exception ee ) {}
|
||||
}
|
||||
}
|
||||
public static String getBaseDir( Context ctx )
|
||||
{
|
||||
// get base dir from private file
|
||||
InputStream configInput = null;
|
||||
try
|
||||
{
|
||||
configInput = ctx.openFileInput( "config.dat" );
|
||||
BufferedReader br = new BufferedReader( new InputStreamReader( configInput ) );
|
||||
return br.readLine();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( configInput != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
configInput.close();
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeBaseDir( Context ctx, String baseDir )
|
||||
{
|
||||
BufferedWriter bw = null;
|
||||
try
|
||||
{
|
||||
OutputStream configOutput = ctx.openFileOutput( "config.dat", Context.MODE_PRIVATE );
|
||||
bw = new BufferedWriter( new OutputStreamWriter (configOutput ) );
|
||||
bw.write( baseDir );
|
||||
bw.write( '\n' );
|
||||
}
|
||||
catch( Exception e ) {}
|
||||
finally
|
||||
{
|
||||
if ( bw != null ) try { bw.close(); } catch( Exception ee ) {}
|
||||
}
|
||||
}
|
||||
public static void writeBaseDir( Context ctx, String baseDir )
|
||||
{
|
||||
BufferedWriter bw = null;
|
||||
try
|
||||
{
|
||||
OutputStream configOutput = ctx.openFileOutput( "config.dat", Context.MODE_PRIVATE );
|
||||
bw = new BufferedWriter( new OutputStreamWriter( configOutput ) );
|
||||
bw.write( baseDir );
|
||||
bw.write( '\n' );
|
||||
}
|
||||
catch (Exception e){ /* ignore */ }
|
||||
finally
|
||||
{
|
||||
if ( bw != null )
|
||||
try
|
||||
{
|
||||
bw.close();
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue