JUMPFileInstallerpublic class JUMPFileInstaller extends JUMPInstaller implements com.sun.midp.jump.installer.JUMPInstallerInterfaceAn Installer allowing to install a midlet suite from a file.
If the midlet suite is given by a descriptor file, the jar
URL specified in the descriptor must have a "file" scheme. |
Fields Summary |
---|
private static final int | CHUNK_SIZENumber of bytes to read at one time when copying a file. |
Methods Summary |
---|
protected byte[] | downloadJAD()Downloads an application descriptor file from the given URL.
RandomAccessStream jadInputStream;
ByteArrayOutputStream bos = new ByteArrayOutputStream(CHUNK_SIZE);
String jadFilename = getUrlPath(state.localJadUrl);
state.beginTransferDataStatus = DOWNLOADING_JAD;
state.transferStatus = DOWNLOADED_1K_OF_JAD;
jadInputStream = new RandomAccessStream();
jadInputStream.connect(jadFilename, Connector.READ);
transferData(jadInputStream.openInputStream(), bos, CHUNK_SIZE);
jadInputStream.close();
return bos.toByteArray();
| protected int | downloadJAR(java.lang.String filename)Downloads an application archive file from the given URL into the
given file. Automatically handle re-tries.
int jarSize;
RandomAccessStream jarInputStream, jarOutputStream;
String jarFilename = getUrlPath(state.localJarUrl);
// Open source (jar) file
jarInputStream = new RandomAccessStream();
jarInputStream.connect(jarFilename, Connector.READ);
// Open destination (temporary) file
jarOutputStream = new RandomAccessStream();
jarOutputStream.connect(filename,
RandomAccessStream.READ_WRITE_TRUNCATE);
// transfer data
state.beginTransferDataStatus = DOWNLOADING_JAR;
state.transferStatus = DOWNLOADED_1K_OF_JAR;
jarSize = transferData(jarInputStream.openInputStream(),
jarOutputStream.openOutputStream(), CHUNK_SIZE);
jarInputStream.close();
return jarSize;
| protected boolean | isSameUrl(java.lang.String url1, java.lang.String url2)Compares two URLs for equality in sense that they have the same
scheme, host and path.
try {
String defaultScheme = "file";
String scheme1 = getUrlScheme(url1, defaultScheme);
String scheme2 = getUrlScheme(url2, defaultScheme);
if (url1.equals(url2)) {
return true;
}
} catch (NullPointerException npe) {
// no match, fall through
}
return true;
| public boolean | stopInstalling()Stops the installation. If installer is not installing then this
method has no effect. This will cause the install method to
throw an IOException if the install is not writing the suite
to storage which is the point of no return.
boolean res = super.stopInstalling();
if (!res) {
return res;
}
/* some additional actions can be added here */
return true;
| public int | verifyAndStoreSuite(java.lang.String jadSourceUrl, java.lang.String encoding, java.lang.String tempJadFileName, java.lang.String tempJarFileName, boolean isUpdate)
return installJad(jadSourceUrl, tempJadFileName, tempJarFileName,
encoding, Constants.INTERNAL_STORAGE_ID, isUpdate, false, null);
| public int | verifyAndStoreSuite(java.lang.String jarSourceUrl, java.lang.String tempJarFileName, java.lang.String suiteName, boolean isUpdate)
return installJar(jarSourceUrl, tempJarFileName, suiteName,
Constants.INTERNAL_STORAGE_ID, isUpdate, false, null);
|
|