【初心者】Java質問・相談スレッド60【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0074デフォルトの名無しさん
NGNGFile f = new File("test.txt");
FileChannel channel = new FileInputStream(f).getChannel();
ByteBuffer buffer = ByteBuffer.allocate((int)f.length());
channel.read(buffer);
channel.close();
buffer.clear();
byte[] bytes = new byte[buffer.capacity()];
buffer.get(bytes);
String s = new String(bytes);
String[] line = Pattern.compile("\\n").split(s);
for(int i=0; i<line.length; i++){
line[i] = line[i].substring(10, line[i].length());
}
こんな感じではだめ?
■ このスレッドは過去ログ倉庫に格納されています