PrintWriter.hx 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. package java.io;
  2. /*
  3. * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
  4. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. *
  6. * This code is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 only, as
  8. * published by the Free Software Foundation. Oracle designates this
  9. * particular file as subject to the "Classpath" exception as provided
  10. * by Oracle in the LICENSE file that accompanied this code.
  11. *
  12. * This code is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * version 2 for more details (a copy is included in the LICENSE file that
  16. * accompanied this code).
  17. *
  18. * You should have received a copy of the GNU General Public License version
  19. * 2 along with this work; if not, write to the Free Software Foundation,
  20. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23. * or visit www.oracle.com if you need additional information or have any
  24. * questions.
  25. */
  26. /**
  27. * Prints formatted representations of objects to a text-output stream. This
  28. * class implements all of the <tt>print</tt> methods found in {@link
  29. * PrintStream}. It does not contain methods for writing raw bytes, for which
  30. * a program should use unencoded byte streams.
  31. *
  32. * <p> Unlike the {@link PrintStream} class, if automatic flushing is enabled
  33. * it will be done only when one of the <tt>println</tt>, <tt>printf</tt>, or
  34. * <tt>format</tt> methods is invoked, rather than whenever a newline character
  35. * happens to be output. These methods use the platform's own notion of line
  36. * separator rather than the newline character.
  37. *
  38. * <p> Methods in this class never throw I/O exceptions, although some of its
  39. * constructors may. The client may inquire as to whether any errors have
  40. * occurred by invoking {@link #checkError checkError()}.
  41. *
  42. * @author Frank Yellin
  43. * @author Mark Reinhold
  44. * @since JDK1.1
  45. */
  46. @:require(java1) extern class PrintWriter extends java.io.Writer
  47. {
  48. /**
  49. * The underlying character-output stream of this
  50. * <code>PrintWriter</code>.
  51. *
  52. * @since 1.2
  53. */
  54. @:require(java2) private var out : java.io.Writer;
  55. /**
  56. * Creates a new PrintWriter, without automatic line flushing.
  57. *
  58. * @param out A character-output stream
  59. */
  60. @:overload public function new(out : java.io.Writer) : Void;
  61. /**
  62. * Creates a new PrintWriter.
  63. *
  64. * @param out A character-output stream
  65. * @param autoFlush A boolean; if true, the <tt>println</tt>,
  66. * <tt>printf</tt>, or <tt>format</tt> methods will
  67. * flush the output buffer
  68. */
  69. @:overload public function new(out : java.io.Writer, autoFlush : Bool) : Void;
  70. /**
  71. * Creates a new PrintWriter, without automatic line flushing, from an
  72. * existing OutputStream. This convenience constructor creates the
  73. * necessary intermediate OutputStreamWriter, which will convert characters
  74. * into bytes using the default character encoding.
  75. *
  76. * @param out An output stream
  77. *
  78. * @see java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
  79. */
  80. @:overload public function new(out : java.io.OutputStream) : Void;
  81. /**
  82. * Creates a new PrintWriter from an existing OutputStream. This
  83. * convenience constructor creates the necessary intermediate
  84. * OutputStreamWriter, which will convert characters into bytes using the
  85. * default character encoding.
  86. *
  87. * @param out An output stream
  88. * @param autoFlush A boolean; if true, the <tt>println</tt>,
  89. * <tt>printf</tt>, or <tt>format</tt> methods will
  90. * flush the output buffer
  91. *
  92. * @see java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
  93. */
  94. @:overload public function new(out : java.io.OutputStream, autoFlush : Bool) : Void;
  95. /**
  96. * Creates a new PrintWriter, without automatic line flushing, with the
  97. * specified file name. This convenience constructor creates the necessary
  98. * intermediate {@link java.io.OutputStreamWriter OutputStreamWriter},
  99. * which will encode characters using the {@linkplain
  100. * java.nio.charset.Charset#defaultCharset() default charset} for this
  101. * instance of the Java virtual machine.
  102. *
  103. * @param fileName
  104. * The name of the file to use as the destination of this writer.
  105. * If the file exists then it will be truncated to zero size;
  106. * otherwise, a new file will be created. The output will be
  107. * written to the file and is buffered.
  108. *
  109. * @throws FileNotFoundException
  110. * If the given string does not denote an existing, writable
  111. * regular file and a new regular file of that name cannot be
  112. * created, or if some other error occurs while opening or
  113. * creating the file
  114. *
  115. * @throws SecurityException
  116. * If a security manager is present and {@link
  117. * SecurityManager#checkWrite checkWrite(fileName)} denies write
  118. * access to the file
  119. *
  120. * @since 1.5
  121. */
  122. @:require(java5) @:overload public function new(fileName : String) : Void;
  123. /**
  124. * Creates a new PrintWriter, without automatic line flushing, with the
  125. * specified file name and charset. This convenience constructor creates
  126. * the necessary intermediate {@link java.io.OutputStreamWriter
  127. * OutputStreamWriter}, which will encode characters using the provided
  128. * charset.
  129. *
  130. * @param fileName
  131. * The name of the file to use as the destination of this writer.
  132. * If the file exists then it will be truncated to zero size;
  133. * otherwise, a new file will be created. The output will be
  134. * written to the file and is buffered.
  135. *
  136. * @param csn
  137. * The name of a supported {@linkplain java.nio.charset.Charset
  138. * charset}
  139. *
  140. * @throws FileNotFoundException
  141. * If the given string does not denote an existing, writable
  142. * regular file and a new regular file of that name cannot be
  143. * created, or if some other error occurs while opening or
  144. * creating the file
  145. *
  146. * @throws SecurityException
  147. * If a security manager is present and {@link
  148. * SecurityManager#checkWrite checkWrite(fileName)} denies write
  149. * access to the file
  150. *
  151. * @throws UnsupportedEncodingException
  152. * If the named charset is not supported
  153. *
  154. * @since 1.5
  155. */
  156. @:require(java5) @:overload public function new(fileName : String, csn : String) : Void;
  157. /**
  158. * Creates a new PrintWriter, without automatic line flushing, with the
  159. * specified file. This convenience constructor creates the necessary
  160. * intermediate {@link java.io.OutputStreamWriter OutputStreamWriter},
  161. * which will encode characters using the {@linkplain
  162. * java.nio.charset.Charset#defaultCharset() default charset} for this
  163. * instance of the Java virtual machine.
  164. *
  165. * @param file
  166. * The file to use as the destination of this writer. If the file
  167. * exists then it will be truncated to zero size; otherwise, a new
  168. * file will be created. The output will be written to the file
  169. * and is buffered.
  170. *
  171. * @throws FileNotFoundException
  172. * If the given file object does not denote an existing, writable
  173. * regular file and a new regular file of that name cannot be
  174. * created, or if some other error occurs while opening or
  175. * creating the file
  176. *
  177. * @throws SecurityException
  178. * If a security manager is present and {@link
  179. * SecurityManager#checkWrite checkWrite(file.getPath())}
  180. * denies write access to the file
  181. *
  182. * @since 1.5
  183. */
  184. @:require(java5) @:overload public function new(file : java.io.File) : Void;
  185. /**
  186. * Creates a new PrintWriter, without automatic line flushing, with the
  187. * specified file and charset. This convenience constructor creates the
  188. * necessary intermediate {@link java.io.OutputStreamWriter
  189. * OutputStreamWriter}, which will encode characters using the provided
  190. * charset.
  191. *
  192. * @param file
  193. * The file to use as the destination of this writer. If the file
  194. * exists then it will be truncated to zero size; otherwise, a new
  195. * file will be created. The output will be written to the file
  196. * and is buffered.
  197. *
  198. * @param csn
  199. * The name of a supported {@linkplain java.nio.charset.Charset
  200. * charset}
  201. *
  202. * @throws FileNotFoundException
  203. * If the given file object does not denote an existing, writable
  204. * regular file and a new regular file of that name cannot be
  205. * created, or if some other error occurs while opening or
  206. * creating the file
  207. *
  208. * @throws SecurityException
  209. * If a security manager is present and {@link
  210. * SecurityManager#checkWrite checkWrite(file.getPath())}
  211. * denies write access to the file
  212. *
  213. * @throws UnsupportedEncodingException
  214. * If the named charset is not supported
  215. *
  216. * @since 1.5
  217. */
  218. @:require(java5) @:overload public function new(file : java.io.File, csn : String) : Void;
  219. /**
  220. * Flushes the stream.
  221. * @see #checkError()
  222. */
  223. @:overload override public function flush() : Void;
  224. /**
  225. * Closes the stream and releases any system resources associated
  226. * with it. Closing a previously closed stream has no effect.
  227. *
  228. * @see #checkError()
  229. */
  230. @:overload override public function close() : Void;
  231. /**
  232. * Flushes the stream if it's not closed and checks its error state.
  233. *
  234. * @return <code>true</code> if the print stream has encountered an error,
  235. * either on the underlying output stream or during a format
  236. * conversion.
  237. */
  238. @:overload public function checkError() : Bool;
  239. /**
  240. * Indicates that an error has occurred.
  241. *
  242. * <p> This method will cause subsequent invocations of {@link
  243. * #checkError()} to return <tt>true</tt> until {@link
  244. * #clearError()} is invoked.
  245. */
  246. @:overload private function setError() : Void;
  247. /**
  248. * Clears the error state of this stream.
  249. *
  250. * <p> This method will cause subsequent invocations of {@link
  251. * #checkError()} to return <tt>false</tt> until another write
  252. * operation fails and invokes {@link #setError()}.
  253. *
  254. * @since 1.6
  255. */
  256. @:require(java6) @:overload private function clearError() : Void;
  257. /**
  258. * Writes a single character.
  259. * @param c int specifying a character to be written.
  260. */
  261. @:overload override public function write(c : Int) : Void;
  262. /**
  263. * Writes A Portion of an array of characters.
  264. * @param buf Array of characters
  265. * @param off Offset from which to start writing characters
  266. * @param len Number of characters to write
  267. */
  268. @:overload override public function write(buf : java.NativeArray<java.StdTypes.Char16>, off : Int, len : Int) : Void;
  269. /**
  270. * Writes an array of characters. This method cannot be inherited from the
  271. * Writer class because it must suppress I/O exceptions.
  272. * @param buf Array of characters to be written
  273. */
  274. @:overload override public function write(buf : java.NativeArray<java.StdTypes.Char16>) : Void;
  275. /**
  276. * Writes a portion of a string.
  277. * @param s A String
  278. * @param off Offset from which to start writing characters
  279. * @param len Number of characters to write
  280. */
  281. @:overload override public function write(s : String, off : Int, len : Int) : Void;
  282. /**
  283. * Writes a string. This method cannot be inherited from the Writer class
  284. * because it must suppress I/O exceptions.
  285. * @param s String to be written
  286. */
  287. @:overload override public function write(s : String) : Void;
  288. /**
  289. * Prints a boolean value. The string produced by <code>{@link
  290. * java.lang.String#valueOf(boolean)}</code> is translated into bytes
  291. * according to the platform's default character encoding, and these bytes
  292. * are written in exactly the manner of the <code>{@link
  293. * #write(int)}</code> method.
  294. *
  295. * @param b The <code>boolean</code> to be printed
  296. */
  297. @:overload public function print(b : Bool) : Void;
  298. /**
  299. * Prints a character. The character is translated into one or more bytes
  300. * according to the platform's default character encoding, and these bytes
  301. * are written in exactly the manner of the <code>{@link
  302. * #write(int)}</code> method.
  303. *
  304. * @param c The <code>char</code> to be printed
  305. */
  306. @:overload public function print(c : java.StdTypes.Char16) : Void;
  307. /**
  308. * Prints an integer. The string produced by <code>{@link
  309. * java.lang.String#valueOf(int)}</code> is translated into bytes according
  310. * to the platform's default character encoding, and these bytes are
  311. * written in exactly the manner of the <code>{@link #write(int)}</code>
  312. * method.
  313. *
  314. * @param i The <code>int</code> to be printed
  315. * @see java.lang.Integer#toString(int)
  316. */
  317. @:overload public function print(i : Int) : Void;
  318. /**
  319. * Prints a long integer. The string produced by <code>{@link
  320. * java.lang.String#valueOf(long)}</code> is translated into bytes
  321. * according to the platform's default character encoding, and these bytes
  322. * are written in exactly the manner of the <code>{@link #write(int)}</code>
  323. * method.
  324. *
  325. * @param l The <code>long</code> to be printed
  326. * @see java.lang.Long#toString(long)
  327. */
  328. @:overload public function print(l : haxe.Int64) : Void;
  329. /**
  330. * Prints a floating-point number. The string produced by <code>{@link
  331. * java.lang.String#valueOf(float)}</code> is translated into bytes
  332. * according to the platform's default character encoding, and these bytes
  333. * are written in exactly the manner of the <code>{@link #write(int)}</code>
  334. * method.
  335. *
  336. * @param f The <code>float</code> to be printed
  337. * @see java.lang.Float#toString(float)
  338. */
  339. @:overload public function print(f : Single) : Void;
  340. /**
  341. * Prints a double-precision floating-point number. The string produced by
  342. * <code>{@link java.lang.String#valueOf(double)}</code> is translated into
  343. * bytes according to the platform's default character encoding, and these
  344. * bytes are written in exactly the manner of the <code>{@link
  345. * #write(int)}</code> method.
  346. *
  347. * @param d The <code>double</code> to be printed
  348. * @see java.lang.Double#toString(double)
  349. */
  350. @:overload public function print(d : Float) : Void;
  351. /**
  352. * Prints an array of characters. The characters are converted into bytes
  353. * according to the platform's default character encoding, and these bytes
  354. * are written in exactly the manner of the <code>{@link #write(int)}</code>
  355. * method.
  356. *
  357. * @param s The array of chars to be printed
  358. *
  359. * @throws NullPointerException If <code>s</code> is <code>null</code>
  360. */
  361. @:overload public function print(s : java.NativeArray<java.StdTypes.Char16>) : Void;
  362. /**
  363. * Prints a string. If the argument is <code>null</code> then the string
  364. * <code>"null"</code> is printed. Otherwise, the string's characters are
  365. * converted into bytes according to the platform's default character
  366. * encoding, and these bytes are written in exactly the manner of the
  367. * <code>{@link #write(int)}</code> method.
  368. *
  369. * @param s The <code>String</code> to be printed
  370. */
  371. @:overload public function print(s : String) : Void;
  372. /**
  373. * Prints an object. The string produced by the <code>{@link
  374. * java.lang.String#valueOf(Object)}</code> method is translated into bytes
  375. * according to the platform's default character encoding, and these bytes
  376. * are written in exactly the manner of the <code>{@link #write(int)}</code>
  377. * method.
  378. *
  379. * @param obj The <code>Object</code> to be printed
  380. * @see java.lang.Object#toString()
  381. */
  382. @:overload public function print(obj : Dynamic) : Void;
  383. /**
  384. * Terminates the current line by writing the line separator string. The
  385. * line separator string is defined by the system property
  386. * <code>line.separator</code>, and is not necessarily a single newline
  387. * character (<code>'\n'</code>).
  388. */
  389. @:overload public function println() : Void;
  390. /**
  391. * Prints a boolean value and then terminates the line. This method behaves
  392. * as though it invokes <code>{@link #print(boolean)}</code> and then
  393. * <code>{@link #println()}</code>.
  394. *
  395. * @param x the <code>boolean</code> value to be printed
  396. */
  397. @:overload public function println(x : Bool) : Void;
  398. /**
  399. * Prints a character and then terminates the line. This method behaves as
  400. * though it invokes <code>{@link #print(char)}</code> and then <code>{@link
  401. * #println()}</code>.
  402. *
  403. * @param x the <code>char</code> value to be printed
  404. */
  405. @:overload public function println(x : java.StdTypes.Char16) : Void;
  406. /**
  407. * Prints an integer and then terminates the line. This method behaves as
  408. * though it invokes <code>{@link #print(int)}</code> and then <code>{@link
  409. * #println()}</code>.
  410. *
  411. * @param x the <code>int</code> value to be printed
  412. */
  413. @:overload public function println(x : Int) : Void;
  414. /**
  415. * Prints a long integer and then terminates the line. This method behaves
  416. * as though it invokes <code>{@link #print(long)}</code> and then
  417. * <code>{@link #println()}</code>.
  418. *
  419. * @param x the <code>long</code> value to be printed
  420. */
  421. @:overload public function println(x : haxe.Int64) : Void;
  422. /**
  423. * Prints a floating-point number and then terminates the line. This method
  424. * behaves as though it invokes <code>{@link #print(float)}</code> and then
  425. * <code>{@link #println()}</code>.
  426. *
  427. * @param x the <code>float</code> value to be printed
  428. */
  429. @:overload public function println(x : Single) : Void;
  430. /**
  431. * Prints a double-precision floating-point number and then terminates the
  432. * line. This method behaves as though it invokes <code>{@link
  433. * #print(double)}</code> and then <code>{@link #println()}</code>.
  434. *
  435. * @param x the <code>double</code> value to be printed
  436. */
  437. @:overload public function println(x : Float) : Void;
  438. /**
  439. * Prints an array of characters and then terminates the line. This method
  440. * behaves as though it invokes <code>{@link #print(char[])}</code> and then
  441. * <code>{@link #println()}</code>.
  442. *
  443. * @param x the array of <code>char</code> values to be printed
  444. */
  445. @:overload public function println(x : java.NativeArray<java.StdTypes.Char16>) : Void;
  446. /**
  447. * Prints a String and then terminates the line. This method behaves as
  448. * though it invokes <code>{@link #print(String)}</code> and then
  449. * <code>{@link #println()}</code>.
  450. *
  451. * @param x the <code>String</code> value to be printed
  452. */
  453. @:overload public function println(x : String) : Void;
  454. /**
  455. * Prints an Object and then terminates the line. This method calls
  456. * at first String.valueOf(x) to get the printed object's string value,
  457. * then behaves as
  458. * though it invokes <code>{@link #print(String)}</code> and then
  459. * <code>{@link #println()}</code>.
  460. *
  461. * @param x The <code>Object</code> to be printed.
  462. */
  463. @:overload public function println(x : Dynamic) : Void;
  464. /**
  465. * A convenience method to write a formatted string to this writer using
  466. * the specified format string and arguments. If automatic flushing is
  467. * enabled, calls to this method will flush the output buffer.
  468. *
  469. * <p> An invocation of this method of the form <tt>out.printf(format,
  470. * args)</tt> behaves in exactly the same way as the invocation
  471. *
  472. * <pre>
  473. * out.format(format, args) </pre>
  474. *
  475. * @param format
  476. * A format string as described in <a
  477. * href="../util/Formatter.html#syntax">Format string syntax</a>.
  478. *
  479. * @param args
  480. * Arguments referenced by the format specifiers in the format
  481. * string. If there are more arguments than format specifiers, the
  482. * extra arguments are ignored. The number of arguments is
  483. * variable and may be zero. The maximum number of arguments is
  484. * limited by the maximum dimension of a Java array as defined by
  485. * <cite>The Java&trade; Virtual Machine Specification</cite>.
  486. * The behaviour on a
  487. * <tt>null</tt> argument depends on the <a
  488. * href="../util/Formatter.html#syntax">conversion</a>.
  489. *
  490. * @throws IllegalFormatException
  491. * If a format string contains an illegal syntax, a format
  492. * specifier that is incompatible with the given arguments,
  493. * insufficient arguments given the format string, or other
  494. * illegal conditions. For specification of all possible
  495. * formatting errors, see the <a
  496. * href="../util/Formatter.html#detail">Details</a> section of the
  497. * formatter class specification.
  498. *
  499. * @throws NullPointerException
  500. * If the <tt>format</tt> is <tt>null</tt>
  501. *
  502. * @return This writer
  503. *
  504. * @since 1.5
  505. */
  506. @:require(java5) @:overload public function printf(format : String, args : java.NativeArray<Dynamic>) : PrintWriter;
  507. /**
  508. * A convenience method to write a formatted string to this writer using
  509. * the specified format string and arguments. If automatic flushing is
  510. * enabled, calls to this method will flush the output buffer.
  511. *
  512. * <p> An invocation of this method of the form <tt>out.printf(l, format,
  513. * args)</tt> behaves in exactly the same way as the invocation
  514. *
  515. * <pre>
  516. * out.format(l, format, args) </pre>
  517. *
  518. * @param l
  519. * The {@linkplain java.util.Locale locale} to apply during
  520. * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
  521. * is applied.
  522. *
  523. * @param format
  524. * A format string as described in <a
  525. * href="../util/Formatter.html#syntax">Format string syntax</a>.
  526. *
  527. * @param args
  528. * Arguments referenced by the format specifiers in the format
  529. * string. If there are more arguments than format specifiers, the
  530. * extra arguments are ignored. The number of arguments is
  531. * variable and may be zero. The maximum number of arguments is
  532. * limited by the maximum dimension of a Java array as defined by
  533. * <cite>The Java&trade; Virtual Machine Specification</cite>.
  534. * The behaviour on a
  535. * <tt>null</tt> argument depends on the <a
  536. * href="../util/Formatter.html#syntax">conversion</a>.
  537. *
  538. * @throws IllegalFormatException
  539. * If a format string contains an illegal syntax, a format
  540. * specifier that is incompatible with the given arguments,
  541. * insufficient arguments given the format string, or other
  542. * illegal conditions. For specification of all possible
  543. * formatting errors, see the <a
  544. * href="../util/Formatter.html#detail">Details</a> section of the
  545. * formatter class specification.
  546. *
  547. * @throws NullPointerException
  548. * If the <tt>format</tt> is <tt>null</tt>
  549. *
  550. * @return This writer
  551. *
  552. * @since 1.5
  553. */
  554. @:require(java5) @:overload public function printf(l : java.util.Locale, format : String, args : java.NativeArray<Dynamic>) : PrintWriter;
  555. /**
  556. * Writes a formatted string to this writer using the specified format
  557. * string and arguments. If automatic flushing is enabled, calls to this
  558. * method will flush the output buffer.
  559. *
  560. * <p> The locale always used is the one returned by {@link
  561. * java.util.Locale#getDefault() Locale.getDefault()}, regardless of any
  562. * previous invocations of other formatting methods on this object.
  563. *
  564. * @param format
  565. * A format string as described in <a
  566. * href="../util/Formatter.html#syntax">Format string syntax</a>.
  567. *
  568. * @param args
  569. * Arguments referenced by the format specifiers in the format
  570. * string. If there are more arguments than format specifiers, the
  571. * extra arguments are ignored. The number of arguments is
  572. * variable and may be zero. The maximum number of arguments is
  573. * limited by the maximum dimension of a Java array as defined by
  574. * <cite>The Java&trade; Virtual Machine Specification</cite>.
  575. * The behaviour on a
  576. * <tt>null</tt> argument depends on the <a
  577. * href="../util/Formatter.html#syntax">conversion</a>.
  578. *
  579. * @throws IllegalFormatException
  580. * If a format string contains an illegal syntax, a format
  581. * specifier that is incompatible with the given arguments,
  582. * insufficient arguments given the format string, or other
  583. * illegal conditions. For specification of all possible
  584. * formatting errors, see the <a
  585. * href="../util/Formatter.html#detail">Details</a> section of the
  586. * Formatter class specification.
  587. *
  588. * @throws NullPointerException
  589. * If the <tt>format</tt> is <tt>null</tt>
  590. *
  591. * @return This writer
  592. *
  593. * @since 1.5
  594. */
  595. @:require(java5) @:overload public function format(format : String, args : java.NativeArray<Dynamic>) : PrintWriter;
  596. /**
  597. * Writes a formatted string to this writer using the specified format
  598. * string and arguments. If automatic flushing is enabled, calls to this
  599. * method will flush the output buffer.
  600. *
  601. * @param l
  602. * The {@linkplain java.util.Locale locale} to apply during
  603. * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
  604. * is applied.
  605. *
  606. * @param format
  607. * A format string as described in <a
  608. * href="../util/Formatter.html#syntax">Format string syntax</a>.
  609. *
  610. * @param args
  611. * Arguments referenced by the format specifiers in the format
  612. * string. If there are more arguments than format specifiers, the
  613. * extra arguments are ignored. The number of arguments is
  614. * variable and may be zero. The maximum number of arguments is
  615. * limited by the maximum dimension of a Java array as defined by
  616. * <cite>The Java&trade; Virtual Machine Specification</cite>.
  617. * The behaviour on a
  618. * <tt>null</tt> argument depends on the <a
  619. * href="../util/Formatter.html#syntax">conversion</a>.
  620. *
  621. * @throws IllegalFormatException
  622. * If a format string contains an illegal syntax, a format
  623. * specifier that is incompatible with the given arguments,
  624. * insufficient arguments given the format string, or other
  625. * illegal conditions. For specification of all possible
  626. * formatting errors, see the <a
  627. * href="../util/Formatter.html#detail">Details</a> section of the
  628. * formatter class specification.
  629. *
  630. * @throws NullPointerException
  631. * If the <tt>format</tt> is <tt>null</tt>
  632. *
  633. * @return This writer
  634. *
  635. * @since 1.5
  636. */
  637. @:require(java5) @:overload public function format(l : java.util.Locale, format : String, args : java.NativeArray<Dynamic>) : PrintWriter;
  638. /**
  639. * Appends the specified character sequence to this writer.
  640. *
  641. * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
  642. * behaves in exactly the same way as the invocation
  643. *
  644. * <pre>
  645. * out.write(csq.toString()) </pre>
  646. *
  647. * <p> Depending on the specification of <tt>toString</tt> for the
  648. * character sequence <tt>csq</tt>, the entire sequence may not be
  649. * appended. For instance, invoking the <tt>toString</tt> method of a
  650. * character buffer will return a subsequence whose content depends upon
  651. * the buffer's position and limit.
  652. *
  653. * @param csq
  654. * The character sequence to append. If <tt>csq</tt> is
  655. * <tt>null</tt>, then the four characters <tt>"null"</tt> are
  656. * appended to this writer.
  657. *
  658. * @return This writer
  659. *
  660. * @since 1.5
  661. */
  662. @:require(java5) @:overload override public function append(csq : java.lang.CharSequence) : PrintWriter;
  663. /**
  664. * Appends a subsequence of the specified character sequence to this writer.
  665. *
  666. * <p> An invocation of this method of the form <tt>out.append(csq, start,
  667. * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
  668. * exactly the same way as the invocation
  669. *
  670. * <pre>
  671. * out.write(csq.subSequence(start, end).toString()) </pre>
  672. *
  673. * @param csq
  674. * The character sequence from which a subsequence will be
  675. * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
  676. * will be appended as if <tt>csq</tt> contained the four
  677. * characters <tt>"null"</tt>.
  678. *
  679. * @param start
  680. * The index of the first character in the subsequence
  681. *
  682. * @param end
  683. * The index of the character following the last character in the
  684. * subsequence
  685. *
  686. * @return This writer
  687. *
  688. * @throws IndexOutOfBoundsException
  689. * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
  690. * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
  691. * <tt>csq.length()</tt>
  692. *
  693. * @since 1.5
  694. */
  695. @:require(java5) @:overload override public function append(csq : java.lang.CharSequence, start : Int, end : Int) : PrintWriter;
  696. /**
  697. * Appends the specified character to this writer.
  698. *
  699. * <p> An invocation of this method of the form <tt>out.append(c)</tt>
  700. * behaves in exactly the same way as the invocation
  701. *
  702. * <pre>
  703. * out.write(c) </pre>
  704. *
  705. * @param c
  706. * The 16-bit character to append
  707. *
  708. * @return This writer
  709. *
  710. * @since 1.5
  711. */
  712. @:require(java5) @:overload override public function append(c : java.StdTypes.Char16) : PrintWriter;
  713. }