I have to read the co-ordinates of a 3D object from the text file that's from PDB and store it in an array and after storing the co-ordinates in the array, I need it to undergo some processes such as rotation & translation and finally, the final product would be a JAR file.
The trick here is that I need to store it in a JAR file so that I can view the final product in my visualizer (Jmol). How do I get about in doing that?
The following code here is the compression of a JAR file.
Is this of use?
import java.io.*;
import java.util.zip.*;
public class compress {
public static void doit(String filein, String fileout)
{
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(filein);
fos = new FileOutputStream(fileout);
ZipOutputStream zos = new ZipOutputStream(fos);
ZipEntry ze = new ZipEntry(filein);
zos.putNextEntry(ze);
final int BUFSIZ = 4096;
byte inbuf[] = new byte[BUFSIZ];
int n;
while ((n = fis.read(inbuf)) != -1)
zos.write(inbuf, 0, n);
fis.close();
fis = null;
zos.close();
fos = null;
}
catch (IOException e) {
System.err.println(e);
}
finally {
try {
if (fis != null)
fis.close();
if (fos != null)
fos.close();
}
catch (IOException e) { }
}
}
public static void main(String args[])
{
if (args.length != 2)
{
System.err.println("missing filenames");
System.exit(1);
}
if (args[0].equals(args[1]))
{
System.err.println("filenames are identical");
System.exit(1);
}
doit(args[0], args[1]);
}
}
Your help is greatly appreciated! :D I need to do this program in JAVA.
I am sorry, but the question is not entirely clear to me... do I understand correctly that you like to rebuild the Jmol jar, to include one particular PDB entry?
Sorry for the lack of clarity. Actually, no. It's 2 PDB entries because I'm doing a superposition algorithm using JAVA. So the target will remain in array1 but the query in array2 will undergo transformation and so on, thus I need the final product/output to be shown in Jmol. Thank you!!
JAR files are used to package and distribute multiple java files as a single file. In fact they are nothing more than a zip archive with an extra directory in it. Therefore you would need to be a little more specific in just what type of JAR file you need.