2362N/A * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An abstract class implementing the <code>ImageOutputStream</code> interface. 0N/A * This class is designed to reduce the number of methods that must 0N/A * be implemented by subclasses. 0N/A * Constructs an <code>ImageOutputStreamImpl</code>. 0N/A // REMIND: Once 6277756 is fixed, we should do a bulk write of all 8 0N/A // bytes here as we do in writeShort() and writeInt() for even better 0N/A // performance. For now, two bulk writes of 4 bytes each is still 0N/A // faster than 8 individual write() calls (see 6347575 for details). 0N/A for (
int i =
0 ; i <
len ; i++) {
0N/A for (
int i =
0; i <
len ; i++) {
0N/A for (
int i =
0; i <
len ; i++) {
0N/A if ((c >=
0x0001) && (c <=
0x007F)) {
0N/A }
else if (c >
0x07FF) {
0N/A if ((c >=
0x0001) && (c <=
0x007F)) {
0N/A }
else if (c >
0x07FF) {
0N/A b[
boff++] = (
byte) (
0xE0 | ((c >>
12) &
0x0F));
0N/A b[
boff++] = (
byte) (
0x80 | ((c >>
6) &
0x3F));
0N/A b[
boff++] = (
byte) (
0x80 | ((c >>
0) &
0x3F));
0N/A b[
boff++] = (
byte) (
0xC0 | ((c >>
6) &
0x1F));
0N/A b[
boff++] = (
byte) (
0x80 | ((c >>
0) &
0x3F));
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > s.length!");
0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > c.length!");
0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > i.length!");
0N/A for (
int j =
0; j <
len; j++) {
0N/A for (
int j =
0; j <
len; j++) {
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > l.length!");
0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > f.length!");
0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A // Fix 4430357 - if off + len < 0, overflow occurred 0N/A (
"off < 0 || len < 0 || off + len > d.length!");
0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A // Prologue: deal with pre-existing bits 0N/A // Bug 4499158, 4507868 - if we're at the beginning of the stream 0N/A // and the bit offset is 0, there can't be any pre-existing bits 0N/A // Notch out the partial byte and drop in the new bits 0N/A // Fill out the partial byte and reduce numBits 0N/A // Note that bitOffset is already 0, so there is no risk 0N/A // of this advancing to the next byte 0N/A // Now write any whole bytes 0N/A // Epilogue: write out remaining partial byte, if any 0N/A // Note that we may be at EOF, in which case we pad with 0, 0N/A // or not, in which case we must preserve the existing bits 0N/A // If we are not at the end of the file, read the current byte 0N/A // If we are at the end of the file, initialize our byte to 0. 0N/A // Fix 4494976: writeBit(int) does not pad the remainder 0N/A // of the current byte with 0s 0N/A // bitOffset is always already 0 when we get here. 0N/A * If the bit offset is non-zero, forces the remaining bits 0N/A * in the current byte to 0 and advances the stream position 0N/A * by one. This method should be called by subclasses at the 0N/A * beginning of the <code>write(int)</code> and 0N/A * <code>write(byte[], int, int)</code> methods. 0N/A * @exception IOException if an I/O error occurs. 0N/A // Fix 4465683: When bitOffset is set 0N/A // to something non-zero beyond EOF, 0N/A // we should set that whole byte to 0N/A // zero and write it to stream.