The Eclipse ADT automatically generates a
R.java
, which keeps track of all the application resources, in hello\gen
as follows:R.java
, which keeps track of all the application resources, in hello\gen
as follows:
private static void list_of_string_into_text_file_and_zip_them_all(List dataList) throws Exception {
File zipFile = new File("OutputZipFile.zip");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
int count = 0;
for (String string : dataList) {
// repeat for each string
String fileNameInsideZip = ++count + "-inside_text_file.txt";
ZipEntry e = new ZipEntry(fileNameInsideZip);
out.putNextEntry(e);
// write data into zip entry
byte[] data = string.getBytes();
out.write(data, 0, data.length);
out.closeEntry();
}
out.flush();
out.close();
}
public static void main(String[] args) throws Exception {
// store string into text file - and zip them . doesnot create a
// temporary text file.
List test = new ArrayList();
test.add("This is amazing");
test.add("What a wonderful world");
test.add("This is a beautiful day ");
list_of_string_into_text_file_and_zip_them_all(test);
}
For creating a single text file from string and zip it - see this post.
private static void zip_single() throws Exception {
final StringBuilder sb = new StringBuilder();
sb.append("Test String that goes into text file inside zip");
final File f = new File("single_text_file_inside.zip");
final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
ZipEntry e = new ZipEntry("inside_text_file.txt");
out.putNextEntry(e);
byte[] data = sb.toString().getBytes();
out.write(data, 0, data.length);
out.closeEntry();
out.close();
}
public static void main(String[] args) throws Exception {
zip_single();
}
import java.io.IOException;
public class StartBrowserUtil {
private StartBrowserUtil() {
}
public static void openURL(String s) {
String s1 = System.getProperty("os.name").toLowerCase();
Runtime runtime = Runtime.getRuntime();
try {
public class TestImagesss {
public static void main(String[] args) {
BufferedImage org = getImage("test.jpg");
BufferedImage negative = getNegativeImage(org);
new ImageFrame(org, "Original");
new ImageFrame(negative, "After Negative");
public final class HexConvertUtils {
private HexConvertUtils() {
}
public static byte[] toBytesFromHex(String hex) {