bndlib fixes

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1363873 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java b/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
index a452c9f..a3763fa 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
@@ -27,7 +27,7 @@
 public class AnnotationReader extends ClassDataCollector {
 	final static TypeRef[]		EMPTY					= new TypeRef[0];
 	final static Pattern		PROPERTY_PATTERN		= Pattern
-																.compile("\\s*([^=\\s:]+)\\s*(?::\\s*(Boolean|Byte|Char|Short|Integer|Long|Float|Double|String)\\s*)?=(.*)");
+																.compile("\\s*([^=\\s:]+)\\s*(?::\\s*(Boolean|Byte|Character|Short|Integer|Long|Float|Double|String)\\s*)?=(.*)");
 
 	public static final Version	V1_1					= new Version("1.1.0");																												// "1.1.0"
 	public static final Version	V1_2					= new Version("1.2.0");																												// "1.1.0"
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
index 4ac92d0..20cc4a4 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
@@ -590,11 +590,11 @@
 			throw new IllegalArgumentException(
 					"the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
 
-		List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
+		Collection<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
 
 		for (int i = 2; i < args.length; i++) {
 			Instructions filters = new Instructions(args[i]);
-			filters.select(files, true);
+			files = filters.select(files, true);
 		}
 
 		List<String> result = new ArrayList<String>();
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
index 09b6a7f..87cd1bc 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
@@ -4,6 +4,7 @@
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.*;
+import java.util.zip.*;
 
 import aQute.lib.converter.*;
 
@@ -16,6 +17,7 @@
 	String				encoding	= "UTF-8";
 
 	boolean				strict;
+	boolean inflate;
 
 	Decoder(JSONCodec codec) {
 		this.codec = codec;
@@ -26,6 +28,10 @@
 	}
 
 	public Decoder from(InputStream in) throws Exception {
+	
+		if ( inflate)
+			in  = new InflaterInputStream(in);
+		
 		return from(new InputStreamReader(in, encoding));
 	}
 
@@ -140,4 +146,11 @@
 			extra = new HashMap<String,Object>();
 		return extra;
 	}
+	
+	public Decoder inflate() {
+		if ( reader != null)
+			throw new IllegalStateException("Reader already set, inflate must come before from()");
+		inflate = true;
+		return this;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Encoder.java b/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
index b6112e7..0808de3 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
@@ -4,6 +4,7 @@
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.*;
+import java.util.zip.*;
 
 public class Encoder implements Appendable, Closeable, Flushable {
 	final JSONCodec	codec;
@@ -11,7 +12,8 @@
 	MessageDigest	digest;
 	boolean			writeDefaults;
 	String			encoding	= "UTF-8";
-
+	boolean deflate;
+	
 	Encoder(JSONCodec codec) {
 		this.codec = codec;
 	}
@@ -21,6 +23,7 @@
 			to();
 
 		codec.encode(this, object, null, new IdentityHashMap<Object,Type>());
+		flush();
 		return this;
 	}
 
@@ -53,6 +56,9 @@
 	}
 
 	public Encoder to(OutputStream out) throws IOException {
+		if ( deflate)
+			out = new DeflaterOutputStream(out);
+		
 		return to(new OutputStreamWriter(out, encoding));
 	}
 
@@ -109,4 +115,10 @@
 			((Flushable) app).flush();
 		}
 	}
+	public Encoder deflate() {
+		if ( app != null)
+			throw new IllegalStateException("Writer already set, deflate must come before to(...)");
+		deflate = true;
+		return this;
+	}
 }