1 /* |
1 /* |
2 * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
377 * |
377 * |
378 * <p> If a character <code>c</code> is in the range |
378 * <p> If a character <code>c</code> is in the range |
379 * <code>\u0001</code> through <code>\u007f</code>, it is |
379 * <code>\u0001</code> through <code>\u007f</code>, it is |
380 * represented by one byte: |
380 * represented by one byte: |
381 * |
381 * |
382 * <p><pre> |
382 * <pre> |
383 * (byte)c |
383 * (byte)c |
384 * </pre> |
384 * </pre> |
385 * |
385 * |
386 * <p> If a character <code>c</code> is <code>\u0000</code> or |
386 * <p> If a character <code>c</code> is <code>\u0000</code> or |
387 * is in the range <code>\u0080</code> through |
387 * is in the range <code>\u0080</code> through |
388 * <code>\u07ff</code>, then it is represented by two bytes, |
388 * <code>\u07ff</code>, then it is represented by two bytes, |
389 * to be written in the order shown: |
389 * to be written in the order shown: |
390 * |
390 * |
391 * <p> <pre><code> |
391 * <pre><code> |
392 * (byte)(0xc0 | (0x1f & (c >> 6))) |
392 * (byte)(0xc0 | (0x1f & (c >> 6))) |
393 * (byte)(0x80 | (0x3f & c)) |
393 * (byte)(0x80 | (0x3f & c)) |
394 * </code></pre> |
394 * </code></pre> |
395 * |
395 * |
396 * <p> If a character <code>c</code> is in the range |
396 * <p> If a character <code>c</code> is in the range |
397 * <code>\u0800</code> through <code>uffff</code>, then it is |
397 * <code>\u0800</code> through <code>uffff</code>, then it is |
398 * represented by three bytes, to be written in the order shown: |
398 * represented by three bytes, to be written in the order shown: |
399 * |
399 * |
400 * <p> <pre><code> |
400 * <pre><code> |
401 * (byte)(0xe0 | (0x0f & (c >> 12))) |
401 * (byte)(0xe0 | (0x0f & (c >> 12))) |
402 * (byte)(0x80 | (0x3f & (c >> 6))) |
402 * (byte)(0x80 | (0x3f & (c >> 6))) |
403 * (byte)(0x80 | (0x3f & c)) |
403 * (byte)(0x80 | (0x3f & c)) |
404 * </code></pre> |
404 * </code></pre> |
405 * |
405 * |