forked from processing/processing-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBufferedReader.xml
More file actions
74 lines (58 loc) · 1.51 KB
/
BufferedReader.xml
File metadata and controls
74 lines (58 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>BufferedReader</name>
<category>Input</category>
<subcategory>Files</subcategory>
<usage>Web & Application</usage>
<example>
<image></image>
<code><![CDATA[
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);
}
}
]]></code>
</example>
<description><![CDATA[
A <b>BufferedReader</b> object is used to read files line-by-line as individual <b>String</b> objects.
<br /><br />
Starting with Processing release 0134, all files loaded and saved by the Processing API use UTF-8 encoding. In previous releases, the default encoding for your platform was used, which causes problems when files are moved to other platforms.
]]></description>
<method>
<mname>readLine()</mname>
<mdescription>returns a String that is the current line in the text file</mdescription>
</method>
<syntax></syntax>
<parameter>
<label></label>
<description></description>
</parameter>
<returns></returns>
<related>
createReader()
try
catch
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>