|
|
@ -666,6 +666,8 @@ public final class FileUtils
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Map<String, String> table(final byte[] a) {
|
|
|
|
public static Map<String, String> table(final byte[] a) {
|
|
|
|
|
|
|
|
if (a == null) return new ConcurrentHashMap<String, String>();
|
|
|
|
|
|
|
|
//System.out.println("***TABLE: a.size = " + a.length);
|
|
|
|
return table(strings(a));
|
|
|
|
return table(strings(a));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -674,9 +676,7 @@ public final class FileUtils
|
|
|
|
return new ArrayList<String>().iterator();
|
|
|
|
return new ArrayList<String>().iterator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return new StringsIterator(new BufferedReader(new InputStreamReader(
|
|
|
|
return new StringsIterator(new BufferedReader(new InputStreamReader(new ByteArrayInputStream(a), "UTF-8")));
|
|
|
|
new ByteArrayInputStream(a),
|
|
|
|
|
|
|
|
"UTF-8")));
|
|
|
|
|
|
|
|
} catch ( final UnsupportedEncodingException e ) {
|
|
|
|
} catch ( final UnsupportedEncodingException e ) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -887,7 +887,7 @@ public final class FileUtils
|
|
|
|
|
|
|
|
|
|
|
|
public static class StringsIterator implements Iterator<String>
|
|
|
|
public static class StringsIterator implements Iterator<String>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private final BufferedReader reader;
|
|
|
|
private BufferedReader reader;
|
|
|
|
private String nextLine;
|
|
|
|
private String nextLine;
|
|
|
|
|
|
|
|
|
|
|
|
public StringsIterator(final BufferedReader reader) {
|
|
|
|
public StringsIterator(final BufferedReader reader) {
|
|
|
@ -904,7 +904,7 @@ public final class FileUtils
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String next() {
|
|
|
|
public String next() {
|
|
|
|
final String line = this.nextLine;
|
|
|
|
final String line = this.nextLine;
|
|
|
|
try {
|
|
|
|
if (this.reader != null) try {
|
|
|
|
while ( (this.nextLine = this.reader.readLine()) != null ) {
|
|
|
|
while ( (this.nextLine = this.reader.readLine()) != null ) {
|
|
|
|
this.nextLine = this.nextLine.trim();
|
|
|
|
this.nextLine = this.nextLine.trim();
|
|
|
|
if ( this.nextLine.length() > 0 ) {
|
|
|
|
if ( this.nextLine.length() > 0 ) {
|
|
|
@ -917,6 +917,13 @@ public final class FileUtils
|
|
|
|
Log.logException(e);
|
|
|
|
Log.logException(e);
|
|
|
|
this.nextLine = null;
|
|
|
|
this.nextLine = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.nextLine == null && this.reader != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
this.reader.close();
|
|
|
|
|
|
|
|
} catch (IOException e) {} finally {
|
|
|
|
|
|
|
|
this.reader = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return line;
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|