Appendable.hx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package java.lang;
  2. /*
  3. * Copyright (c) 2003, 2004, 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. * An object to which <tt>char</tt> sequences and values can be appended. The
  28. * <tt>Appendable</tt> interface must be implemented by any class whose
  29. * instances are intended to receive formatted output from a {@link
  30. * java.util.Formatter}.
  31. *
  32. * <p> The characters to be appended should be valid Unicode characters as
  33. * described in <a href="Character.html#unicode">Unicode Character
  34. * Representation</a>. Note that supplementary characters may be composed of
  35. * multiple 16-bit <tt>char</tt> values.
  36. *
  37. * <p> Appendables are not necessarily safe for multithreaded access. Thread
  38. * safety is the responsibility of classes that extend and implement this
  39. * interface.
  40. *
  41. * <p> Since this interface may be implemented by existing classes
  42. * with different styles of error handling there is no guarantee that
  43. * errors will be propagated to the invoker.
  44. *
  45. * @since 1.5
  46. */
  47. @:require(java5) extern interface Appendable
  48. {
  49. /**
  50. * Appends the specified character sequence to this <tt>Appendable</tt>.
  51. *
  52. * <p> Depending on which class implements the character sequence
  53. * <tt>csq</tt>, the entire sequence may not be appended. For
  54. * instance, if <tt>csq</tt> is a {@link java.nio.CharBuffer} then
  55. * the subsequence to append is defined by the buffer's position and limit.
  56. *
  57. * @param csq
  58. * The character sequence to append. If <tt>csq</tt> is
  59. * <tt>null</tt>, then the four characters <tt>"null"</tt> are
  60. * appended to this Appendable.
  61. *
  62. * @return A reference to this <tt>Appendable</tt>
  63. *
  64. * @throws IOException
  65. * If an I/O error occurs
  66. */
  67. @:overload public function append(csq : java.lang.CharSequence) : Appendable;
  68. /**
  69. * Appends a subsequence of the specified character sequence to this
  70. * <tt>Appendable</tt>.
  71. *
  72. * <p> An invocation of this method of the form <tt>out.append(csq, start,
  73. * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
  74. * exactly the same way as the invocation
  75. *
  76. * <pre>
  77. * out.append(csq.subSequence(start, end)) </pre>
  78. *
  79. * @param csq
  80. * The character sequence from which a subsequence will be
  81. * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
  82. * will be appended as if <tt>csq</tt> contained the four
  83. * characters <tt>"null"</tt>.
  84. *
  85. * @param start
  86. * The index of the first character in the subsequence
  87. *
  88. * @param end
  89. * The index of the character following the last character in the
  90. * subsequence
  91. *
  92. * @return A reference to this <tt>Appendable</tt>
  93. *
  94. * @throws IndexOutOfBoundsException
  95. * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
  96. * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
  97. * <tt>csq.length()</tt>
  98. *
  99. * @throws IOException
  100. * If an I/O error occurs
  101. */
  102. @:overload public function append(csq : java.lang.CharSequence, start : Int, end : Int) : Appendable;
  103. /**
  104. * Appends the specified character to this <tt>Appendable</tt>.
  105. *
  106. * @param c
  107. * The character to append
  108. *
  109. * @return A reference to this <tt>Appendable</tt>
  110. *
  111. * @throws IOException
  112. * If an I/O error occurs
  113. */
  114. @:overload public function append(c : java.StdTypes.Char16) : Appendable;
  115. }