38 |
|
|
39 |
package gnu.java.io.decode; |
package gnu.java.io.decode; |
40 |
|
|
|
import java.io.CharConversionException; |
|
41 |
import java.io.IOException; |
import java.io.IOException; |
42 |
import java.io.InputStream; |
import java.io.InputStream; |
43 |
import java.io.Reader; |
import java.io.Reader; |
123 |
* |
* |
124 |
* @return The number of characters than can be decoded from the byte array |
* @return The number of characters than can be decoded from the byte array |
125 |
* |
* |
|
* @exception CharConversionException If the bytes do not evenly translate to characters, or an invalid byte is encountered. |
|
126 |
*/ |
*/ |
127 |
public int |
public int |
128 |
charsInByteArray(byte[] buf) throws CharConversionException |
charsInByteArray(byte[] buf) |
129 |
{ |
{ |
130 |
return(charsInByteArray(buf, 0, buf.length)); |
return(charsInByteArray(buf, 0, buf.length)); |
131 |
} |
} |
146 |
* |
* |
147 |
* @return The number of characters than can be decoded from the byte array |
* @return The number of characters than can be decoded from the byte array |
148 |
* |
* |
|
* @exception CharConversionException If the bytes do not evenly translate to characters, or an invalid byte is encountered. |
|
149 |
*/ |
*/ |
150 |
public abstract int |
public abstract int |
151 |
charsInByteArray(byte[] buf, int offset, int len) throws CharConversionException; |
charsInByteArray(byte[] buf, int offset, int len); |
152 |
|
|
153 |
/*************************************************************************/ |
/*************************************************************************/ |
154 |
|
|
160 |
* |
* |
161 |
* @return The converted char array |
* @return The converted char array |
162 |
* |
* |
|
* @exception CharConversionException If an error occurs, such as an invalid byte in the source array. |
|
163 |
*/ |
*/ |
164 |
public char[] |
public char[] |
165 |
convertToChars(byte[] buf) throws CharConversionException |
convertToChars(byte[] buf) |
166 |
{ |
{ |
167 |
return(convertToChars(buf, 0, buf.length)); |
return(convertToChars(buf, 0, buf.length)); |
168 |
} |
} |
180 |
* |
* |
181 |
* @return The converted char array |
* @return The converted char array |
182 |
* |
* |
|
* @exception CharConversionException If an error occurs, such as an invalid byte in the source array. |
|
183 |
*/ |
*/ |
184 |
public char[] |
public char[] |
185 |
convertToChars(byte[] buf, int offset, int len) throws CharConversionException |
convertToChars(byte[] buf, int offset, int len) |
186 |
{ |
{ |
187 |
char[] cbuf = new char[charsInByteArray(buf, offset, len)]; |
char[] cbuf = new char[charsInByteArray(buf, offset, len)]; |
188 |
|
|
207 |
* @return The char array passed by the caller as a param, now filled with converted characters. |
* @return The char array passed by the caller as a param, now filled with converted characters. |
208 |
* |
* |
209 |
* @exception ArrayIndexOutOfBoundsException If the destination char array is not big enough to hold all the converted characters |
* @exception ArrayIndexOutOfBoundsException If the destination char array is not big enough to hold all the converted characters |
|
* @exception CharConversionException If an error occurs, such as an invalid byte in the source array. |
|
210 |
*/ |
*/ |
211 |
public char[] |
public char[] |
212 |
convertToChars(byte[] buf, char[] cbuf, int cbuf_offset) throws |
convertToChars(byte[] buf, char[] cbuf, int cbuf_offset) |
|
CharConversionException |
|
213 |
{ |
{ |
214 |
return(convertToChars(buf, 0, buf.length, cbuf, cbuf_offset)); |
return(convertToChars(buf, 0, buf.length, cbuf, cbuf_offset)); |
215 |
} |
} |
235 |
* @return The char array passed by the caller as a param, now filled with converted characters. |
* @return The char array passed by the caller as a param, now filled with converted characters. |
236 |
* |
* |
237 |
* @exception ArrayIndexOutOfBoundsException If the destination char array is not big enough to hold all the converted characters |
* @exception ArrayIndexOutOfBoundsException If the destination char array is not big enough to hold all the converted characters |
|
* @exception CharConversionException If an error occurs, such as an invalid byte in the source array. |
|
238 |
*/ |
*/ |
239 |
public abstract char[] |
public abstract char[] |
240 |
convertToChars(byte[] buf, int buf_offset, int len, char[] cbuf, |
convertToChars(byte[] buf, int buf_offset, int len, char[] cbuf, |
241 |
int cbuf_offset) throws CharConversionException; |
int cbuf_offset); |
242 |
|
|
243 |
/*************************************************************************/ |
/*************************************************************************/ |
244 |
|
|