[PATCH 5 of 5] issue1494: If encoding is set in collectionOut, use it

Wald Commits scm-commit at wald.intevation.org
Wed Sep 25 10:29:58 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1380098439 -7200
# Node ID 31dc80c489361f43ccbacf674d07986e1478e9f1
# Parent  30b7ca3951c7a52cd632bdc85e74915d85c89cd6
issue1494: If encoding is set in collectionOut, use it.

diff -r 30b7ca3951c7 -r 31dc80c48936 src/main/java/org/dive4elements/artifacts/httpclient/http/HttpClientImpl.java
--- a/src/main/java/org/dive4elements/artifacts/httpclient/http/HttpClientImpl.java	Wed Sep 25 10:39:59 2013 +0200
+++ b/src/main/java/org/dive4elements/artifacts/httpclient/http/HttpClientImpl.java	Wed Sep 25 10:40:39 2013 +0200
@@ -493,8 +493,14 @@
         try {
             InputStream stream = collectionOut(doc, uuid, type);
 
-            byte[] b = new byte[4096];
+            // Transcode if charset is given.
+            if (charset != null) {
+                collectionOutEnc(stream, out);
+                return;
+            }
+
             try {
+                byte[] b = new byte[4096];
                 int i;
                 while ((i = stream.read(b)) >= 0) {
                     out.write(b, 0, i);


More information about the Dive4elements-commits mailing list