Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
InternalBinaryStringEncoder | 31 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.crypto.internal.encoder; | |
21 | ||
22 | import java.io.IOException; | |
23 | import java.io.OutputStream; | |
24 | ||
25 | /** | |
26 | * Encode and decode byte arrays (typically from binary to 7-bit ASCII encodings). | |
27 | * | |
28 | * @version $Id: a78ca03129e2680fd573a29a723276d8dce551a1 $ | |
29 | * @since 5.4M1 | |
30 | */ | |
31 | public interface InternalBinaryStringEncoder | |
32 | { | |
33 | /** | |
34 | * Encode the given buffer area to the given output stream. | |
35 | * | |
36 | * @param buffer buffer to encode. | |
37 | * @param offset offset in the buffer to start from. | |
38 | * @param length len of the area to encode from the buffer. | |
39 | * @param outputStream the output stream to write data to. | |
40 | * @return the number bytes written to the output stream. | |
41 | * @throws IOException on error. | |
42 | */ | |
43 | int encode(byte[] buffer, int offset, int length, OutputStream outputStream) throws IOException; | |
44 | ||
45 | /** | |
46 | * Decode the given buffer area to the given input stream. | |
47 | * | |
48 | * @param buffer buffer to decode. | |
49 | * @param offset offset in the buffer to start from. | |
50 | * @param length len of the area to decode from the buffer. | |
51 | * @param outputStream the output stream to write data to. | |
52 | * @return the number bytes written to the output stream. | |
53 | * @throws IOException on error. | |
54 | */ | |
55 | int decode(byte[] buffer, int offset, int length, OutputStream outputStream) throws IOException; | |
56 | ||
57 | /** | |
58 | * Check is the given byte is a valid byte of encoded data. | |
59 | * | |
60 | * @param b byte to check. | |
61 | * @return true if the byte is a valid encoded data. | |
62 | */ | |
63 | boolean isValidEncoding(byte b); | |
64 | ||
65 | /** | |
66 | * @return the number of bytes of binary data that should be encoded together during progressive encoding. | |
67 | */ | |
68 | int getEncodingBlockSize(); | |
69 | ||
70 | /** | |
71 | * @return the number of bytes of string data that should be decoded together during progressive decoding. | |
72 | */ | |
73 | int getDecodingBlockSize(); | |
74 | } |