title: Detect line breaks in a `char[]`
body: <p>I use to employ the following method to detect if a character is a whitespace:</p>
  
  <pre><code>Character.isWhiteSpace(char character);
  </code></pre>
  
  <p>Now I need to detect all the variants of <strong>line breaks</strong> (<code>\n</code>, <code>\r</code>, etc.) for all platforms (Linux, Windows, Mac OSX, etc.). Is there any similar way to detect if a character is a line break? If there is not, how can I detect all the possible variants?</p>
  
  <hr>
  
  <p><strong>Edit from comments:</strong> As I didn't know that line breaks can be represented by several characters, I add some context to the question.</p>
  
  <p>I'm implementing the <code>write(char[] buffer, int offset, int length)</code> method in a <code>Writer</code> (see <a href="http://docs.oracle.com/javase/7/docs/api/java/io/Writer.html#write(char[],%20int,%20int)" rel="noreferrer">Javadoc</a>). In addition to other operations, I need to detect line breaks inside the <code>buffer</code>. I'm trying to avoid creating an <code>String</code> from the <code>buffer</code> to preserve memory, as I've seen that sometimes the <code>buffer</code> is too big (several MB). </p>
  
  <p>Is there any way to detect line breaks without creating a <code>String</code>?</p>