<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    On 28/09/2024 17:15, Markus Karg wrote:<br>
    <blockquote type="cite" cite="mid:000001db11c1$b22a7990$167f6cb0$@eu">
      
      <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">:<o:p></o:p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Alternatives:<o:p></o:p></p>
        <p class="MsoNormal">- Applications could use Apache Commons
          IO's CharSequenceReader. As it is an open-source third-party
          dependency, some authors might not be allowed to use it, or
          may not want to carry this additional burden just for the sake
          of this single performance improvement. In addition, this
          library is not very actively maintained; its Java baseline
          still is Java 8. There is no commercial support.<o:p></o:p></p>
        <p class="MsoNormal">- Applications could write their own Reader
          implementation. Given the assumption that this is a rather
          common use case, this imposes unjustified additional work for
          the authors of thousands of applications. It is hard to
          justify why there is a StringReader but not a
          CharSequenceReader.<o:p></o:p></p>
        <p class="MsoNormal">- Instead of writing a new
          CharSequenceReader class we could slightly modify
          StringReader, so it accepts CharSequences (not only Strings).
          This does not remove the synchronization overhead unless we
          decide to remove the synchronization from StringReader's
          implementation, and it would be confusing / surprising (in the
          negative sense) that a class named "StringReader" actually is
          a "CharSequenceReader".<o:p></o:p></p>
        <br>
      </div>
    </blockquote>
    <br>
    Add to your list to explore is a static factory method on Reader,
    look at Reader.nullReader. That would avoid exposing yet another
    very specific implementation class in the API. The specification of
    that method could say that is isn't safe for use by concurrent
    threads. That doesn't excuse you completely from thinking about
    concurrent use as Readers have a close method so you'll need to
    think about how close is specified for when it is called while
    another thread is reading chars from a custom CS.<br>
    <br>
    -Alan.<br>
  </body>
</html>