Skip to content

Commit a23156e

Browse files
committed
Correct license
Javadocs Use ProxyInputStream as base class to reduce code. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@140372 13f79535-47bb-0310-9956-ffa450edef68
1 parent 05c1bb9 commit a23156e

1 file changed

Lines changed: 50 additions & 82 deletions

File tree

Lines changed: 50 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
package org.apache.commons.io.input;
2-
31
/* ====================================================================
42
* The Apache Software License, Version 1.1
53
*
6-
* Copyright (c) 2001 The Apache Software Foundation. All rights
4+
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
75
* reserved.
86
*
97
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +16,21 @@
1816
* the documentation and/or other materials provided with the
1917
* distribution.
2018
*
21-
* 3. The end-user documentation included with the redistribution,
22-
* if any, must include the following acknowledgment:
19+
* 3. The end-user documentation included with the redistribution, if
20+
* any, must include the following acknowlegement:
2321
* "This product includes software developed by the
2422
* Apache Software Foundation (http://www.apache.org/)."
25-
* Alternately, this acknowledgment may appear in the software itself,
26-
* if and wherever such third-party acknowledgments normally appear.
23+
* Alternately, this acknowlegement may appear in the software itself,
24+
* if and wherever such third-party acknowlegements normally appear.
2725
*
28-
* 4. The names "Apache" and "Apache Software Foundation" and
29-
* "Apache Turbine" must not be used to endorse or promote products
30-
* derived from this software without prior written permission. For
31-
* written permission, please contact apache@apache.org.
26+
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
27+
* Foundation" must not be used to endorse or promote products derived
28+
* from this software without prior written permission. For written
29+
* permission, please contact apache@apache.org.
3230
*
33-
* 5. Products derived from this software may not be called "Apache",
34-
* "Apache Turbine", nor may "Apache" appear in their name, without
35-
* prior written permission of the Apache Software Foundation.
31+
* 5. Products derived from this software may not be called "Apache"
32+
* nor may "Apache" appear in their names without prior written
33+
* permission of the Apache Software Foundation.
3634
*
3735
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
3836
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -53,6 +51,7 @@
5351
* information on the Apache Software Foundation, please see
5452
* <http://www.apache.org/>.
5553
*/
54+
package org.apache.commons.io.input;
5655

5756
import java.io.DataInput;
5857
import java.io.EOFException;
@@ -64,57 +63,67 @@
6463
/**
6564
* DataInput for systems relying on little endian data formats.
6665
*
66+
* <p><b>Origin of code: </b>Avalon Excalibur (IO)</p>
67+
*
6768
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
68-
* @version CVS $Revision: 1.2 $ $Date: 2003/07/25 07:51:26 $
69-
* @since 4.0
69+
* @version CVS $Revision: 1.3 $ $Date: 2003/07/27 17:15:06 $
7070
*/
71-
public class SwappedDataInputStream
71+
public class SwappedDataInputStream extends ProxyInputStream
7272
implements DataInput
7373
{
74-
//The underlying input stream
75-
private InputStream m_input;
7674

75+
/**
76+
* Constructs a SwappedDataInputStream.
77+
* @param input InputStream to read from
78+
*/
7779
public SwappedDataInputStream( final InputStream input )
7880
{
79-
m_input = input;
81+
super( input );
8082
}
8183

84+
/** @see java.io.DataInput#readBoolean() */
8285
public boolean readBoolean()
8386
throws IOException, EOFException
8487
{
8588
return ( 0 == readByte() );
8689
}
8790

91+
/** @see java.io.DataInput#readByte() */
8892
public byte readByte()
8993
throws IOException, EOFException
9094
{
91-
return (byte)m_input.read();
95+
return (byte)in.read();
9296
}
9397

98+
/** @see java.io.DataInput#readChar() */
9499
public char readChar()
95100
throws IOException, EOFException
96101
{
97102
return (char)readShort();
98103
}
99104

105+
/** @see java.io.DataInput#readDouble() */
100106
public double readDouble()
101107
throws IOException, EOFException
102108
{
103-
return EndianUtils.readSwappedDouble( m_input );
109+
return EndianUtils.readSwappedDouble( in );
104110
}
105111

112+
/** @see java.io.DataInput#readFloat() */
106113
public float readFloat()
107114
throws IOException, EOFException
108115
{
109-
return EndianUtils.readSwappedFloat( m_input );
116+
return EndianUtils.readSwappedFloat( in );
110117
}
111118

119+
/** @see java.io.DataInput#readFully(byte[]) */
112120
public void readFully( final byte[] data )
113121
throws IOException, EOFException
114122
{
115123
readFully( data, 0, data.length );
116124
}
117125

126+
/** @see java.io.DataInput#readFully(byte[], int, int) */
118127
public void readFully( final byte[] data, final int offset, final int length )
119128
throws IOException, EOFException
120129
{
@@ -134,103 +143,62 @@ public void readFully( final byte[] data, final int offset, final int length )
134143
}
135144
}
136145

146+
/** @see java.io.DataInput#readInt() */
137147
public int readInt()
138148
throws IOException, EOFException
139149
{
140-
return EndianUtils.readSwappedInteger( m_input );
150+
return EndianUtils.readSwappedInteger( in );
141151
}
142152

153+
/** @see java.io.DataInput#readLine() */
143154
public String readLine()
144155
throws IOException, EOFException
145156
{
146-
throw new IOException( "Operation not supported" );
157+
throw new UnsupportedOperationException(
158+
"Operation not supported: readLine()" );
147159
}
148160

161+
/** @see java.io.DataInput#readLong() */
149162
public long readLong()
150163
throws IOException, EOFException
151164
{
152-
return EndianUtils.readSwappedLong( m_input );
165+
return EndianUtils.readSwappedLong( in );
153166
}
154167

168+
/** @see java.io.DataInput#readShort() */
155169
public short readShort()
156170
throws IOException, EOFException
157171
{
158-
return EndianUtils.readSwappedShort( m_input );
172+
return EndianUtils.readSwappedShort( in );
159173
}
160174

175+
/** @see java.io.DataInput#readUnsignedByte() */
161176
public int readUnsignedByte()
162177
throws IOException, EOFException
163178
{
164-
return m_input.read();
179+
return in.read();
165180
}
166181

182+
/** @see java.io.DataInput#readUnsignedShort() */
167183
public int readUnsignedShort()
168184
throws IOException, EOFException
169185
{
170-
return EndianUtils.readSwappedUnsignedShort( m_input );
186+
return EndianUtils.readSwappedUnsignedShort( in );
171187
}
172188

189+
/** @see java.io.DataInput#readUTF() */
173190
public String readUTF()
174191
throws IOException, EOFException
175192
{
176-
throw new IOException( "Operation not supported" );
193+
throw new UnsupportedOperationException(
194+
"Operation not supported: readUTF()" );
177195
}
178196

197+
/** @see java.io.DataInput#skipBytes(int) */
179198
public int skipBytes( final int count )
180199
throws IOException, EOFException
181200
{
182-
return (int)m_input.skip( count );
183-
}
184-
185-
public int available()
186-
throws IOException, EOFException
187-
{
188-
return m_input.available();
189-
}
190-
191-
public void close()
192-
throws IOException, EOFException
193-
{
194-
m_input.close();
195-
}
196-
197-
public int read()
198-
throws IOException, EOFException
199-
{
200-
return m_input.read();
201-
}
202-
203-
public int read( final byte[] data )
204-
throws IOException, EOFException
205-
{
206-
return read( data, 0, data.length );
207-
}
208-
209-
public int read( final byte[] data, final int offset, final int length )
210-
throws IOException, EOFException
211-
{
212-
return m_input.read( data, offset, length );
213-
}
214-
215-
public long skip( final long count )
216-
throws IOException, EOFException
217-
{
218-
return m_input.skip( count );
201+
return (int)in.skip( count );
219202
}
220203

221-
public void mark( final int readLimit )
222-
{
223-
m_input.mark( readLimit );
224-
}
225-
226-
public boolean markSupported()
227-
{
228-
return m_input.markSupported();
229-
}
230-
231-
public void reset()
232-
throws IOException
233-
{
234-
m_input.reset();
235-
}
236204
}

0 commit comments

Comments
 (0)