blob: 0fef78f1d1a1f71500a07e3b9dfde27af8789724 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 */
21
22package javax.imageio.stream;
23
24import java.io.IOException;
25import java.nio.ByteOrder;
26
27/*
28 * @author Rustem V. Rafikov
29 * @version $Revision: 1.3 $
30 */
31
32/**
33 * The ImageOutputStreamImpl abstract class implements the ImageOutputStream
34 * interface.
35 *
36 * @since Android 1.0
37 */
38public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl implements
39 ImageOutputStream {
40
41 /**
42 * Instantiates a new ImageOutputStreamImpl.
43 */
44 public ImageOutputStreamImpl() {
45 }
46
47 public abstract void write(int b) throws IOException;
48
49 public void write(byte[] b) throws IOException {
50 write(b, 0, b.length);
51 }
52
53 public abstract void write(byte[] b, int off, int len) throws IOException;
54
55 public void writeBoolean(boolean v) throws IOException {
56 write(v ? 1 : 0);
57 }
58
59 public void writeByte(int v) throws IOException {
60 write(v);
61 }
62
63 public void writeShort(int v) throws IOException {
64 if (byteOrder == ByteOrder.BIG_ENDIAN) {
65
66 } else {
67
68 }
69 // -- TODO implement
70 throw new UnsupportedOperationException("Not implemented yet");
71 }
72
73 public void writeChar(int v) throws IOException {
74 writeShort(v);
75 }
76
77 public void writeInt(int v) throws IOException {
78 if (byteOrder == ByteOrder.BIG_ENDIAN) {
79
80 } else {
81
82 }
83 // -- TODO implement
84 throw new UnsupportedOperationException("Not implemented yet");
85 }
86
87 public void writeLong(long v) throws IOException {
88 if (byteOrder == ByteOrder.BIG_ENDIAN) {
89
90 } else {
91
92 }
93 // -- TODO implement
94 throw new UnsupportedOperationException("Not implemented yet");
95 }
96
97 public void writeFloat(float v) throws IOException {
98 writeInt(Float.floatToIntBits(v));
99 }
100
101 public void writeDouble(double v) throws IOException {
102 writeLong(Double.doubleToLongBits(v));
103 }
104
105 public void writeBytes(String s) throws IOException {
106 write(s.getBytes());
107 }
108
109 public void writeChars(String s) throws IOException {
110 char[] chs = s.toCharArray();
111 writeChars(chs, 0, chs.length);
112 }
113
114 public void writeUTF(String s) throws IOException {
115 // -- TODO implement
116 throw new UnsupportedOperationException("Not implemented yet");
117 }
118
119 public void writeShorts(short[] s, int off, int len) throws IOException {
120 // -- TODO implement
121 throw new UnsupportedOperationException("Not implemented yet");
122 }
123
124 public void writeChars(char[] c, int off, int len) throws IOException {
125 // -- TODO implement
126 throw new UnsupportedOperationException("Not implemented yet");
127 }
128
129 public void writeInts(int[] i, int off, int len) throws IOException {
130 // -- TODO implement
131 throw new UnsupportedOperationException("Not implemented yet");
132 }
133
134 public void writeLongs(long[] l, int off, int len) throws IOException {
135 // -- TODO implement
136 throw new UnsupportedOperationException("Not implemented yet");
137 }
138
139 public void writeFloats(float[] f, int off, int len) throws IOException {
140 // -- TODO implement
141 throw new UnsupportedOperationException("Not implemented yet");
142 }
143
144 public void writeDoubles(double[] d, int off, int len) throws IOException {
145 // -- TODO implement
146 throw new UnsupportedOperationException("Not implemented yet");
147 }
148
149 public void writeBit(int bit) throws IOException {
150 // -- TODO implement
151 throw new UnsupportedOperationException("Not implemented yet");
152 }
153
154 public void writeBits(long bits, int numBits) throws IOException {
155 // -- TODO implement
156 throw new UnsupportedOperationException("Not implemented yet");
157 }
158
159 /**
160 * Flushes the bits. This method should be called in the write methods by
161 * subclasses.
162 *
163 * @throws IOException
164 * if an I/O exception has occurred.
165 */
166 protected final void flushBits() throws IOException {
167 if (bitOffset == 0) {
168 return;
169 }
170
171 // -- TODO implement
172 throw new UnsupportedOperationException("Not implemented yet");
173 }
174}