|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.Jars
public class Jars
9/06 This class is not finished, but findSelf(boolean) usually works assuming you're not in an applet,
and often has problems finding CodeSimian.jar in non-Windows operating-systems. Needs to be fixed asap.
Finding self is necessary for codesimian's more advanced abilities.
Contains static functions for using, combining, breeding, and evolving JAR files.
For example, find 1 CodeSimian.jar that contains a few different files
from this program (an executing CodeSimian.jar) or find 2 different CodeSimian.jar's,
and combine some of their different files to create a new CodeSimian.jar with different behaviors.
Each software is 1 file (CodeSimian4.jar CodeSimian556.jar etc) and can modify other similar softwares.
NEED TO BUILD: a way to create and execute new JAR files IN MEMORY ONLY
for if a hard-drive is not available like in an APPLET in a webpage.
| Nested Class Summary | |
|---|---|
static class |
Jars.JarTest
|
static class |
Jars.SaveUpdatedSelf
saves a new CodeSimian.jar somewhere. |
static class |
Jars.ZipEntryAndByteArray
|
| Method Summary | |
|---|---|
static java.io.ByteArrayInputStream |
breed(java.io.ByteArrayInputStream[] jars)
Breeds 2 or more modified CodeSimian.jar's into a single CodeSimian.jar which is returned |
static java.io.ByteArrayInputStream |
consumeAnotherProgram(java.io.ByteArrayInputStream anyOtherJarProgram)
any JAR file contains classes and maybe other files that CodeSimian might consume by copying it into a new CodeSimian.jar This class should search for a license text file and license at top of source-code files and announce this info to a LicenseListener object (LicenseListener interface not yet created 9/06). |
static java.io.ByteArrayInputStream |
consumeAnyBytes(java.lang.String nameOrDescription,
java.io.InputStream anything)
Creates a new JAR file (a new version of the currently-executing CodeSimian.jar) after consuming some bytes. |
static java.io.ByteArrayInputStream |
consumeSimilar(java.io.ByteArrayInputStream similarToMe,
int minBytesToConsume,
int maxBytesToConsume)
Modifies this program executing now and saves it in a new CodeSimian.jar. |
static java.io.ByteArrayInputStream[] |
findAnythingOnTheInternet(CS byteJudger,
java.net.URL[] startSearchingHere,
int howManyFilesDoYouWant,
long maxMilliseconds,
long minBytesEach,
long maxBytesEach)
|
static java.io.ByteArrayInputStream[] |
findJarsOnTheInternet(CS jarJudger,
java.net.URL[] startSearchingHere,
int howManyJarsDoYouWant,
long maxMilliseconds,
long minBytesEachJar,
long maxBytesEachJar)
Uses jarJudger.setL(ByteArrayInputStream) then executes jarJudger.D() to judge JARs it finds on the internet, and based on how jarJudger judges, tries to find better JARs on the internet next time you call this function with the same (or similar?) jarJudger object. |
static java.lang.String[] |
findLicenses(java.io.ByteArrayInputStream anyJar)
should return strings like "GNU GPL" "GNU LGPL" "public domain" "new BSD" "License of Guile" etc, or whichever licenses your program that uses CodeSimian allows. |
static java.io.ByteArrayInputStream |
findSelf(boolean createApproximateSelfIfCanOnlyFindPartsOfSelf)
returns the CodeSimian.jar that contains this program executing now, or null if could not find it. |
static java.io.ByteArrayInputStream[] |
findSimilarToSelf()
returns Jar files it thinks are most similar to the CodeSimian.jar currently executing. |
static float |
GPLcompatible(java.io.ByteArrayInputStream anyJar)
is a JAR file compatible with the GNU GPL license? All LGPL, new BSD, and many other licenses are GPL-compatible. |
static float |
LGPLcompatible(java.io.ByteArrayInputStream anyJar)
is a JAR file compatible with the GNU LGPL license? Unlike GPL, LGPL allows you to sell modifications of software. |
static byte[] |
readBytesForCurrentEntry(java.util.zip.ZipEntry currentEntry,
java.util.zip.ZipInputStream jarIn)
jarIn.getNextJarEntry() must have returned currentEntry the last time it was called, because that positions the ByteArrayInputStream to the beginning of the entry. |
static Jars.ZipEntryAndByteArray[] |
unzip(java.util.zip.ZipInputStream zipIn)
unzip all files in zipIn |
static java.io.ByteArrayInputStream |
updateSelf(boolean createFromParts)
returns the bytes for a new CodeSimian.jar, including all files in the original CodeSimian.jar (returned by findSelf()), except for files deleted by deleteInternalFile and files added or modified by setInternalFile (in InternalFiles.java). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.io.ByteArrayInputStream findSelf(boolean createApproximateSelfIfCanOnlyFindPartsOfSelf)
createApproximateSelfIfCanOnlyFindPartsOfSelf - WARNING: approximate self Jars often do not work
because they are made of less than all the files inside CodeSimian.jar and some files are required.
9/06 no code exists to approximate a JAR, but this ability should be added later
in case all the files cant be found, or if a JAR needs to be repaired...public static java.io.ByteArrayInputStream[] findSimilarToSelf()
public static java.io.ByteArrayInputStream consumeSimilar(java.io.ByteArrayInputStream similarToMe,
int minBytesToConsume,
int maxBytesToConsume)
public static java.io.ByteArrayInputStream consumeAnotherProgram(java.io.ByteArrayInputStream anyOtherJarProgram)
public static java.io.ByteArrayInputStream[] findJarsOnTheInternet(CS jarJudger,
java.net.URL[] startSearchingHere,
int howManyJarsDoYouWant,
long maxMilliseconds,
long minBytesEachJar,
long maxBytesEachJar)
public static java.io.ByteArrayInputStream[] findAnythingOnTheInternet(CS byteJudger,
java.net.URL[] startSearchingHere,
int howManyFilesDoYouWant,
long maxMilliseconds,
long minBytesEach,
long maxBytesEach)
public static java.io.ByteArrayInputStream consumeAnyBytes(java.lang.String nameOrDescription,
java.io.InputStream anything)
nameOrDescription - a filename, for example. Can be null.public static java.io.ByteArrayInputStream breed(java.io.ByteArrayInputStream[] jars)
public static float GPLcompatible(java.io.ByteArrayInputStream anyJar)
public static float LGPLcompatible(java.io.ByteArrayInputStream anyJar)
public static java.lang.String[] findLicenses(java.io.ByteArrayInputStream anyJar)
public static byte[] readBytesForCurrentEntry(java.util.zip.ZipEntry currentEntry,
java.util.zip.ZipInputStream jarIn)
public static Jars.ZipEntryAndByteArray[] unzip(java.util.zip.ZipInputStream zipIn)
public static java.io.ByteArrayInputStream updateSelf(boolean createFromParts)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||