IDEA-93289 (count usages; mixed case)

This commit is contained in:
Roman Shevchenko
2012-11-04 21:32:10 +01:00
parent 42eb417800
commit eb25a5dda0
4 changed files with 146 additions and 19 deletions
@@ -0,0 +1,22 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
class C {
void m(File file) throws IOException {
<caret>FileInputStream fileInputStream = new FileInputStream(file);
int read, len = -1;
boolean empty = true;
do {
read = fileInputStream.read();
char[] chars = Character.toChars(read);
System.out.println(read + " = " + Arrays.toString(chars));
++len;
empty = false;
}
while (read != -1);
System.out.println(len);
System.out.println(empty);
}
}
@@ -0,0 +1,26 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
class C {
void m(File file) throws IOException {
int len;
boolean empty;
try (FileInputStream fileInputStream = new FileInputStream(file)) {
int read;
len = -1;
empty = true;
do {
read = fileInputStream.read();
char[] chars = Character.toChars(read);
System.out.println(read + " = " + Arrays.toString(chars));
++len;
empty = false;
}
while (read != -1);
}
System.out.println(len);
System.out.println(empty);
}
}