Problem
You want to download javadocs for your depenencies into local repository to be able to use them ie. in IntelliJ.
Solution
mvn dependency:resolve -Dclassifier=javadoc
mvn dependency:resolve -Dclassifier=sources
Enjoy!
Posted by Piotr Gabryanczyk on June 25, 2009
You want to download javadocs for your depenencies into local repository to be able to use them ie. in IntelliJ.
mvn dependency:resolve -Dclassifier=javadoc
mvn dependency:resolve -Dclassifier=sources
Enjoy!
Posted in java | Tagged: maven maven2 javadoc javadocs sources | 2 Comments »
Posted by Piotr Gabryanczyk on June 8, 2009
Check this class out:
Compressor.java
import java.io.*;
import java.util.zip.*;
import org.apache.commons.io.IOUtils;
public class Compressor{
public static byte[] compress(byte[] content){
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try{
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gzipOutputStream.write(content);
gzipOutputStream.close();
} catch(IOException e){
throw new RuntimeException(e);
}
System.out.printf("Compression ratio %f\n", (1.0f * content.length/byteArrayOutputStream.size()));
return byteArrayOutputStream.toByteArray();
}
public static byte[] decompress(byte[] contentBytes){
ByteArrayOutputStream out = new ByteArrayOutputStream();
try{
IOUtils.copy(new GZIPInputStream(new ByteArrayInputStream(contentBytes)), out);
} catch(IOException e){
throw new RuntimeException(e);
}
return out.toByteArray();
}
public static boolean notWorthCompressing(String contentType){
return contentType.contains("jpeg")
|| contentType.contains("pdf")
|| contentType.contains("zip")
|| contentType.contains("mpeg")
|| contentType.contains("avi");
}
}
Dependencies: Apache commons-io.jar
Posted in Uncategorized | Leave a Comment »