Copy files in Java Using JNI - java

How can I copy files in Java using JNI on OS X?

You shouldn't use JNI to copy files. If you are looking for performance with copying a lot of files you should take a look at the new Java NIO File Channels.

You don't need JNI to copy files. The standard J2SE libraries will handle this. For a more powerful library, see Apache Commons IO FileUtils.

Related

Java decompressing archive packed by implode method

I need to create some software which works with ZIP archives compressed with very old implode method.
Tried to write decompressor but nothing good happened. Optimized C-code is very hard for me.
Found this C-implementation (here) but cannot write it on Java. Just found request in Apache-commons about this feature (JIRA contatin link to APPNOTES.TXT with method description).
I should write cross-platform decompressor for this method.
Perfect is native-Java implementation.
Looking for help. Thanks.
Starting with the version 1.7 Apache Commons Compress can decompress imploded and shrunk zip entries. This is a pure Java implementation of the algorithm.
http://commons.apache.org/compress/
Did you try if TrueZip supports those older formats?
sevenzipjbinding - 7-Zip-JBinding is a java wrapper for 7-Zip C++ library. It allows extraction of many archive formats using a very fast native library directly from java through JNI.

Processing ARJ File in Java

Is there any way to process/read/write ARJ compressed file in java without extracting to some directory ?
7-zip has Java bindings for its c++ apis.
Have a look at http://commons.apache.org/compress/ if you want to stay within a JVM and not rely on native apps

Which tool/plug-in can be used to copy files from remote location in least possible time?

My need is to copy some of the zipped files from remote location to my machine and then unzip it in specific location. By which way it can be achieved in fastest way? Are there any open source tool already available for that? I know about Robocopy, but is there any other tool also, better than Robocopy?
I'm using windows xp operating system. I have to do this inside my eclipse application, so I need the tool or any plugin which I can easily incorporate in my eclipse application.
Thanks a lot in advance!!!
Related to adarshr's answer, you could use the Apache Commons IO or NET projects (see http://commons.apache.org/). Or if you want something with paid support you could use JScape. These are Java API's that allow you to do IO and FTP'ing. Then you could use either the java.util.zip classes for zipping/unzipping, or the Apache Compress project.
Any of these options gives you flexibility at the Java programming level.
You probably need an FTP client such as Filezilla.
For working with remote files from within eclipse, take a look at the RSE (Remote System Explorer) Plugin

Java compression and splitting library - preferrably 7zip

I am looking for a java library which can compress files and directories.
I need the following features
-compress
-decompress
-split archives to multiple files based on a size limit
I would really like the following features as well
-encrypt archives
-encrypt file names
I would prefer if the solution was a 7zip library but it's not required.
I know there is an lzma Java sdk but i'm not sure if it supports all the features above. I know it doesn't support encryption, but does it support splitting archives?
Any library supporting all the features above would be preferred.
Thanks.
How about the Deflater/Inflater classes mentioned in the question "What’s a good compression library for Java?".
I know the current interfaces proposed by Java are Stream-based, not "filename"-based, but according to the following article on Java compression.
TrueZip should be able to do most of what you need

Cross platform file compression

We need a cross platform solution for compressing files. Our server runs on Windows XP/Vista/7 and 3 Unix distros, SunOS, HPUX, and AIX. Our server creates files that needed to be zipped before being set back to the client. Our initial thought was to compress the files with jar, as most of the servers have java installed, but apparently jar isn't included in the jre, just the jdk. Our server is written in C and the application that needs to create a compressed file is Perl.
I'd really like something I don't have install as our install base is LARGE and adding new required applications is generally difficult. Is there anything that is guaranteed to be built into each of those OSes that I could use for zipping? Even if I have to use something different for each, that would probably be okay also.
If you don't want to have to install anything you're pretty much SOL. Windows doesn't make this easy.
If you want to write something yourself java.util.zip is in the Java 2 Standard Edition (J2SE) and Perl has Archive::Zip
I do like 7-zip a lot but for situations like yours I always go to least-common denominataor: ZIP. Simple old ZIP. Most Unices and linuxes have zip and unzip. And for windows there are lots of options, including 7-zip, that can manipulate zip files. And probably the clients will have a zip client installed.
You could always consider distributing an open source compression tool or even using a compression SDK as part of your app such as 7 ZIP's
If you have Java installed (no matter JRE or JDK), you can use the pack200 and unpack200 to create and unpack the archives. Pack200 uses gzip compression which is pretty standard.
You should note that pack200 doesn't allow to compress multiple files in one archive (nature of gzip). If it's required, you can implement your own tool in pure Java that will create zip files and run anywhere with the unified command line interface (Java has built-in zip support, see some samples).
If you go that route, you can also use the native java implementation of bz2 or 7zip formats to get better compression.

Categories