Processing, 类BufferedReader
用法介绍。
说明
BufferedReader
对象用于将文件 line-by-line 作为单独的 String
对象读取。
从处理版本 0134 开始,处理 API 加载和保存的所有文件都使用 UTF-8 编码。在以前的版本中,使用了您平台的默认编码,这在将文件移动到其他平台时会导致问题。
例子
BufferedReader reader;
String line;
void setup() {
// Open the file from the createWriter() example
reader = createReader("positions.txt");
}
void draw() {
try {
line = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
line = null;
}
if (line == null) {
// Stop reading because of an error or file is empty
noLoop();
} else {
String[] pieces = split(line, TAB);
int x = int(pieces[0]);
int y = int(pieces[1]);
point(x, y);
}
}
方法
- BufferedReader.readLine()返回一个字符串,它是 BufferedReader 中的当前行。
有关的
相关用法
- Processing BufferedReader.readLine()用法及代码示例
- Processing BrownNoise.play()用法及代码示例
- Processing BrownNoise.pan()用法及代码示例
- Processing BrownNoise.add()用法及代码示例
- Processing BandPass.bw()用法及代码示例
- Processing BandPass.set()用法及代码示例
- Processing BandPass.freq()用法及代码示例
- Processing BandPass用法及代码示例
- Processing BrownNoise用法及代码示例
- Processing BrownNoise.set()用法及代码示例
- Processing BandPass.stop()用法及代码示例
- Processing BrownNoise.amp()用法及代码示例
- Processing BrownNoise.stop()用法及代码示例
- Processing BandPass.process()用法及代码示例
- Processing FFT用法及代码示例
- Processing SawOsc.pan()用法及代码示例
- Processing FloatDict用法及代码示例
- Processing FFT.stop()用法及代码示例
- Processing join()用法及代码示例
- Processing () (parentheses)用法及代码示例
- Processing Pulse用法及代码示例
- Processing PShader用法及代码示例
- Processing PVector.set()用法及代码示例
- Processing FloatDict.sortKeysReverse()用法及代码示例
- Processing texture()用法及代码示例
注:本文由纯净天空筛选整理自processing.org大神的英文原创作品 BufferedReader。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。