-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathPrintWriter.xml
More file actions
executable file
·76 lines (54 loc) · 1.52 KB
/
PrintWriter.xml
File metadata and controls
executable file
·76 lines (54 loc) · 1.52 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
75
76
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>PrintWriter</name>
<category>Output</category>
<subcategory>Files</subcategory>
<usage>Web & Application</usage>
<example>
<image></image>
<code><![CDATA[
PrintWriter output;
void setup() {
// Create a new file in the sketch directory
output = createWriter("positions.txt");
}
void draw() {
point(mouseX, mouseY);
output.println(mouseX); // Write the coordinate to the file
}
void keyPressed() {
output.flush(); // Writes the remaining data to the file
output.close(); // Finishes the file
exit(); // Stops the program
}
]]></code>
</example>
<description><![CDATA[
Allows characters to print to a text-output stream. A new PrintWriter object is created with the <b>createWriter()</b> function. For the file to be made correctly, it should be flushed and must be closed with its <b>flush()</b> and <b>close()</b> methods (see above example).
]]></description>
<syntax></syntax>
<method>
<mname>print()</mname>
<mdescription>Adds data to the stream</mdescription>
</method>
<method>
<mname>println()</mname>
<mdescription>Adds data to the stream and starts a new line</mdescription>
</method>
<method>
<mname>flush()</mname>
<mdescription>Flushes the stream</mdescription>
</method>
<method>
<mname>close()</mname>
<mdescription>Closes the stream</mdescription>
</method>
<constructor> </constructor>
<returns></returns>
<related>
createWriter()
</related>
<availability>1.0</availability>
<type>Object</type>
<partof>PDE</partof>
</root>