blob: c3d80fa7bee61ff957352335cb10ec6c6881074e [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * @author Rustem V. Rafikov
19 * @version $Revision: 1.3 $
20 */
21package javax.imageio.stream;
22
23import java.io.IOException;
24import java.nio.ByteOrder;
25
26/*
27 * @author Rustem V. Rafikov
28 * @version $Revision: 1.3 $
29 */
30
31/**
32 * The ImageOutputStreamImpl abstract class implements
33 * the ImageOutputStream interface.
34 */
35public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl
36 implements ImageOutputStream {
37
38 /**
39 * Instantiates a new ImageOutputStreamImpl.
40 */
41 public ImageOutputStreamImpl() {}
42
43 public abstract void write(int b) throws IOException;
44
45 public void write(byte[] b) throws IOException {
46 write(b, 0, b.length);
47 }
48
49 public abstract void write(byte[] b, int off, int len) throws IOException;
50
51 public void writeBoolean(boolean v) throws IOException {
52 write(v ? 1 : 0);
53 }
54
55 public void writeByte(int v) throws IOException {
56 write(v);
57 }
58
59 public void writeShort(int v) throws IOException {
60 if (byteOrder == ByteOrder.BIG_ENDIAN) {
61
62 } else {
63
64 }
65 //-- TODO implement
66 throw new UnsupportedOperationException("Not implemented yet");
67 }
68
69 public void writeChar(int v) throws IOException {
70 writeShort(v);
71 }
72
73 public void writeInt(int v) throws IOException {
74 if (byteOrder == ByteOrder.BIG_ENDIAN) {
75
76 } else {
77
78 }
79 //-- TODO implement
80 throw new UnsupportedOperationException("Not implemented yet");
81 }
82
83 public void writeLong(long v) throws IOException {
84 if (byteOrder == ByteOrder.BIG_ENDIAN) {
85
86 } else {
87
88 }
89 //-- TODO implement
90 throw new UnsupportedOperationException("Not implemented yet");
91 }
92
93 public void writeFloat(float v) throws IOException {
94 writeInt(Float.floatToIntBits(v));
95 }
96
97 public void writeDouble(double v) throws IOException {
98 writeLong(Double.doubleToLongBits(v));
99 }
100
101 public void writeBytes(String s) throws IOException {
102 write(s.getBytes());
103 }
104
105 public void writeChars(String s) throws IOException {
106 char[] chs = s.toCharArray();
107 writeChars(chs, 0, chs.length);
108 }
109
110 public void writeUTF(String s) throws IOException {
111 //-- TODO implement
112 throw new UnsupportedOperationException("Not implemented yet");
113 }
114
115 public void writeShorts(short[] s, int off, int len) throws IOException {
116 //-- TODO implement
117 throw new UnsupportedOperationException("Not implemented yet");
118 }
119
120 public void writeChars(char[] c, int off, int len) throws IOException {
121 //-- TODO implement
122 throw new UnsupportedOperationException("Not implemented yet");
123 }
124
125 public void writeInts(int[] i, int off, int len) throws IOException {
126 //-- TODO implement
127 throw new UnsupportedOperationException("Not implemented yet");
128 }
129
130 public void writeLongs(long[] l, int off, int len) throws IOException {
131 //-- TODO implement
132 throw new UnsupportedOperationException("Not implemented yet");
133 }
134
135 public void writeFloats(float[] f, int off, int len) throws IOException {
136 //-- TODO implement
137 throw new UnsupportedOperationException("Not implemented yet");
138 }
139
140 public void writeDoubles(double[] d, int off, int len) throws IOException {
141 //-- TODO implement
142 throw new UnsupportedOperationException("Not implemented yet");
143 }
144
145 public void writeBit(int bit) throws IOException {
146 //-- TODO implement
147 throw new UnsupportedOperationException("Not implemented yet");
148 }
149
150 public void writeBits(long bits, int numBits) throws IOException {
151 //-- TODO implement
152 throw new UnsupportedOperationException("Not implemented yet");
153 }
154
155 /**
156 * Flushes the bits. This method should be called in the write
157 * methods by subclasses.
158 *
159 * @throws IOException Signals that an I/O exception has occurred.
160 */
161 protected final void flushBits() throws IOException {
162 if (bitOffset == 0) {
163 return;
164 }
165
166 //-- TODO implement
167 throw new UnsupportedOperationException("Not implemented yet");
168 }
169}