|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.blogspot.applications4android.comicreader.core.FileUtils
public class FileUtils
Class containing helper methods for working on files
Field Summary | |
---|---|
static int |
BUFF_SIZE
buffer size (in bytes) for BufferedReader's |
static java.lang.String |
COMIC_ROOT
root folder for storing info |
static int |
MIN_BYTES_SDCARD_MB
minimum sd-card free space required for this app (in MB) |
static int |
SB_CAPACITY
string builder size (in bytes) |
Method Summary | |
---|---|
static void |
checkFreeSpaceSdcard()
Checks whether there's enough space on the sd-card |
static boolean |
copyFile(java.io.File src,
java.io.File dst)
Copy source file to destination |
static boolean |
delete(java.io.File file)
Delete a file/folder if it exists |
static java.io.File |
getComicRoot()
Gets the root comic folder |
static java.io.File |
getSdcard()
Returns the path to the sdcard |
static java.lang.String |
getTempFile()
Get a temporary filename using Time + Random. |
static java.lang.String |
getTempFile(java.lang.String prefix,
java.lang.String suffix)
Get a temporary filename using Time + Random. |
static boolean |
mkdir(java.io.File folder)
Create a folder if it doesn't exist already. |
static int |
numLines(java.io.File file)
Calculate the number of lines in the plain text file. |
static int |
numLines(java.io.Reader in)
Calculate the number of lines in the plain text file |
static void |
recursiveDelete(java.io.File dir)
Recursively delete a directory (equivalent to 'rm -rf') |
static long |
sdcardAvailableBytesMB()
Gets the available number of bytes in your sdcard (in MB) |
static java.lang.String |
slurp(java.io.InputStream is)
Read the whole file into a string. |
static java.lang.String |
slurp(java.lang.String file,
AssetManager am)
Slurp a file (which is present in the android_asset) into a string |
static void |
storeString(java.lang.String s,
java.io.File f)
Store a string to the file |
static boolean |
touch(java.lang.String file)
Creates an empty file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFF_SIZE
public static final int SB_CAPACITY
public static final int MIN_BYTES_SDCARD_MB
public static final java.lang.String COMIC_ROOT
Method Detail |
---|
public static void recursiveDelete(java.io.File dir)
dir
- directory to be deletedpublic static boolean touch(java.lang.String file)
file
- file to be created
public static int numLines(java.io.Reader in)
in
- reader
public static int numLines(java.io.File file)
file
- the file of interest
public static java.lang.String slurp(java.io.InputStream is) throws java.io.IOException
is
- file pointer
java.io.IOException
public static java.lang.String slurp(java.lang.String file, AssetManager am) throws java.io.IOException
file
- the file of interestam
- the asset manager which will be used to find the input file
java.io.IOException
public static void storeString(java.lang.String s, java.io.File f) throws java.io.IOException, ComicSDCardFull
s
- stringf
- file
java.io.IOException
ComicSDCardFull
public static boolean delete(java.io.File file)
file
- the file to be deleted.
public static boolean mkdir(java.io.File folder)
folder
- the folder to be created if it doesn't exist.
public static java.lang.String getTempFile(java.lang.String prefix, java.lang.String suffix)
prefix
- the prefix to be used for this temp file.suffix
- the suffix to be used for this temp file.
public static java.lang.String getTempFile()
public static void checkFreeSpaceSdcard() throws ComicSDCardFull
ComicSDCardFull
public static long sdcardAvailableBytesMB()
public static java.io.File getSdcard()
public static java.io.File getComicRoot()
public static boolean copyFile(java.io.File src, java.io.File dst)
src
- source locationdst
- destination location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |