01: /*
02: * $Id: CharsetDecoder.java,v 1.4 2004/07/08 08:01:29 yuvalo Exp $
03: *
04: * (C) Copyright 2002-2004 by Yuval Oren. All rights reserved.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package com.bluecast.io;
20:
21: import java.io.CharConversionException;
22:
23: /**
24: * Converts bytes to characters.
25: *
26: * @author Yuval Oren
27: * @version $Revision: 1.4 $
28: *
29: */
30: public interface CharsetDecoder {
31:
32: /** Minimum number of characters produced per byte using
33: * this decoder.
34: */
35: public int minBytesPerChar();
36:
37: /** Minimum number of characters produced per byte using
38: * this decoder.
39: */
40: public int maxBytesPerChar();
41:
42: /**
43: * Decodes an array of bytes into characters.
44: *
45: * @param in_buf input byte buffer
46: * @param in_off starting byte buffer offset
47: * @param in_len max number of bytes to read
48: * @param out_buf output character buffer
49: * @param out_off char buffer offset at which to start writing
50: * @param out_len max number of chars to write
51: * @param result an array of size >= 2 where results are returned:
52: * result[0] = number of bytes read.
53: * result[1] = number of chars written
54: */
55: public void decode(byte[] in_buf, int in_off, int in_len,
56: char[] out_buf, int out_off, int out_len, int[] result)
57: throws CharConversionException;
58:
59: public CharsetDecoder newCharsetDecoder();
60:
61: public void reset();
62: }
|