[Android] src: Read in newlines as well in readAsset

Edward Wang git at videolan.org
Tue Jul 3 22:02:01 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Jul  3 14:56:36 2012 -0400| [4e0a9c70a3817bbef055221f1d5b42a02f03cce0] | committer: Edward Wang

src: Read in newlines as well in readAsset

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=4e0a9c70a3817bbef055221f1d5b42a02f03cce0
---

 vlc-android/src/org/videolan/vlc/Util.java |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 85ebbd8..f66010a 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -27,11 +27,13 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.text.DecimalFormat;
+import java.util.Enumeration;
 import java.util.Properties;
 
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.net.Uri;
+import android.util.Log;
 import android.view.View;
 import android.widget.Toast;
 
@@ -81,9 +83,14 @@ public class Util {
             BufferedReader r = new BufferedReader(new InputStreamReader(is, "UTF8"));
             StringBuilder sb = new StringBuilder();
             String line = r.readLine();
-            while(line != null) {
+            if(line != null) {
                 sb.append(line);
                 line = r.readLine();
+                while(line != null) {
+                    sb.append('\n');
+                    sb.append(line);
+                    line = r.readLine();
+                }
             }
             return sb.toString();
         } catch (IOException e) {



More information about the Android mailing list