Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/Utils.java

Issue 29398555: Issue 5058 - Fix code style in Utils class (Closed)
Patch Set: Created March 30, 2017, 5:38 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 return array.toString(); 96 return array.toString();
97 } 97 }
98 98
99 public static String readAssetAsString(Context context, String filename) throw s IOException 99 public static String readAssetAsString(Context context, String filename) throw s IOException
100 { 100 {
101 BufferedReader in = null; 101 BufferedReader in = null;
102 try { 102 try
103 {
103 StringBuilder buf = new StringBuilder(); 104 StringBuilder buf = new StringBuilder();
104 InputStream is = context.getAssets().open(filename); 105 InputStream is = context.getAssets().open(filename);
105 in = new BufferedReader(new InputStreamReader(is)); 106 in = new BufferedReader(new InputStreamReader(is));
106 107
107 String str; 108 String str;
108 boolean isFirst = true; 109 boolean isFirst = true;
109 while ( (str = in.readLine()) != null ) { 110 while ((str = in.readLine()) != null)
111 {
110 if (isFirst) 112 if (isFirst)
113 {
111 isFirst = false; 114 isFirst = false;
115 }
112 else 116 else
117 {
113 buf.append('\n'); 118 buf.append('\n');
119 }
114 buf.append(str); 120 buf.append(str);
115 } 121 }
116 return buf.toString(); 122 return buf.toString();
117 } finally { 123 }
118 if (in != null) { 124 finally
119 try { 125 {
126 if (in != null)
127 {
128 try
129 {
120 in.close(); 130 in.close();
121 } catch (IOException e) { 131 }
132 catch (IOException e)
133 {
122 // ignored 134 // ignored
123 } 135 }
124 } 136 }
125 } 137 }
126 } 138 }
127 } 139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld