|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.Files
public class Files
problem: not all CSs are Serializable
Nested Class Summary | |
---|---|
static class |
Files.DefaultDownloader
P(0) is filename or url. |
static interface |
Files.DownloadListener
Watches a download of a file or URL many times as more and more bytes are downloaded. |
static class |
Files.GrowingByteArrayInputStream
same as ByteArrayInputStream except ByteArrayInputStream.count can be set by a function, which causes more and more bytes to be available (or less?), without replacing the byte[] array. |
static class |
Files.LoadCSFromFile
Puts the CS from the file in param0. |
static class |
Files.SaveBytesP1IntoFileP0
|
static class |
Files.SaveCSToFile
param0 is the CS to be Serialized and saved to file. |
static class |
Files.TextFileWriter
Maps a CS's params to a file. |
Constructor Summary | |
---|---|
Files()
|
Method Summary | |
---|---|
static java.util.List<java.io.File> |
allFoldersRecursive(java.io.File folder)
includes folder. |
static java.lang.String |
changeBackToForwardSlashesAndAddSlashAtEndIfFolder(java.lang.String fileOrFolder)
|
static byte[] |
download(java.io.InputStream in)
later, modify this to have a progress bar if data is large. |
static byte[] |
download(java.lang.String fileNameOrURL)
later, modify this to have a progress bar if data is large |
static byte[] |
download(java.lang.String fileNameOrURL,
Files.DownloadListener listener)
Downloads the bytes from a file or URL, and tells a Files.DownloadListener about the progress downloading. |
static byte[] |
downloadTEST(java.lang.String fileNameOrURL,
Files.DownloadListener listener)
|
static java.io.InputStream |
fileNameOrURLToInputStream(java.lang.String fileNameOrURL)
|
static java.lang.String[] |
findFiles(CS fileNameJudger,
CS fileSizeJudger,
CS fileBytesJudger,
CS searchingForTooLongJudger,
int maxFileNamesReturned)
Returns a list of paths + filenames of files on this computer's hard-drive(s). |
static java.lang.String |
findFirstFileWithThisName(java.lang.String fileName,
float maxSecondsToSearch)
Example: findFirstFileWithThisName("javac.exe") may return "C:\\java\\jdk\\bin\\javac.exe" |
static java.util.List<java.io.File> |
getAllFilesWithFoldersFirst(java.io.File fileOrFolder)
example: x/ < x/y/ < x/y/z/ < x/y/file.txt x/lowerfile.txt x/y/anotherfile.bat |
static byte[] |
getBytesFromFile(java.io.File file)
|
static java.io.ByteArrayInputStream |
getFolderOrURLAsZIP(java.lang.String folderNameOrURL)
if folderNameOrURL is the name of a local folder (directory) then returns a ZIP file containing the files and subfolders of the specified folder. |
static boolean |
isFolderPathName(java.lang.String folderPathName)
|
static void |
main(java.lang.String[] a)
|
static void |
saveBytesToFile(byte[] data,
java.io.File file)
|
static java.io.File |
suggestNonexistantJarFile(java.io.File folder)
returns the first File with name CodeSimianX.jar where X is a number (2 or higher) and that file does not exist on the hard-drive in that folder. |
static void |
upload(java.io.OutputStream out,
byte[] data)
later, modify this to have a progress bar if data is large |
static void |
upload(java.lang.String fileNameOrURL,
byte[] data)
later, modify this to have a progress bar if data is large |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Files()
Method Detail |
---|
public static void saveBytesToFile(byte[] data, java.io.File file) throws java.io.IOException
java.io.IOException
public static byte[] getBytesFromFile(java.io.File file) throws java.io.IOException
java.io.IOException
public static java.io.ByteArrayInputStream getFolderOrURLAsZIP(java.lang.String folderNameOrURL)
public static byte[] download(java.lang.String fileNameOrURL)
public static byte[] download(java.io.InputStream in)
public static void upload(java.lang.String fileNameOrURL, byte[] data)
public static void upload(java.io.OutputStream out, byte[] data)
public static void main(java.lang.String[] a) throws java.io.IOException
java.io.IOException
public static java.io.InputStream fileNameOrURLToInputStream(java.lang.String fileNameOrURL) throws java.io.IOException
java.io.IOException
public static byte[] downloadTEST(java.lang.String fileNameOrURL, Files.DownloadListener listener)
public static byte[] download(java.lang.String fileNameOrURL, Files.DownloadListener listener)
public static java.io.File suggestNonexistantJarFile(java.io.File folder)
public static java.lang.String[] findFiles(CS fileNameJudger, CS fileSizeJudger, CS fileBytesJudger, CS searchingForTooLongJudger, int maxFileNamesReturned)
fileNameJudger
- Param0 is set to a String filename. Return a number proportional
to the chance the filename is one the caller is looking for.
0 or less means 0 chance of returning that file.
fileBytesJudger
- Param0 is set to a list of bytes of the file.
Returns positive if the bytes are more what the caller wants.
Returns 0 or negative if cant use the file because its bytes fail this test.
fileSizeJudger
- Param0 is set to the number of bytes of the file found.
Returns positive if the file is small enough.
Returns 0 or negative if it cant be returned because its too big.
continueSearchingJudger
- Param0 is set to the number of
seconds (using System.currentTimeMillis()) since this function was called.
Param1 is set to quantity of good files found so far. Returns true if should continue searchingpublic static java.lang.String findFirstFileWithThisName(java.lang.String fileName, float maxSecondsToSearch)
public static boolean isFolderPathName(java.lang.String folderPathName)
public static java.lang.String changeBackToForwardSlashesAndAddSlashAtEndIfFolder(java.lang.String fileOrFolder)
public static java.util.List<java.io.File> getAllFilesWithFoldersFirst(java.io.File fileOrFolder)
public static java.util.List<java.io.File> allFoldersRecursive(java.io.File folder)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |