01: /*
02:
03: Derby - Class org.apache.derby.impl.drda.CcsidManager
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21: package org.apache.derby.impl.drda;
22:
23: // Peforms character conversions.
24: abstract class CcsidManager {
25: byte space; // ' ' character
26: byte dot; // '.' character
27:
28: // Byte array used to convert numbers into
29: // bytes containing the character representation "value" for the particular ccsid.
30: byte[] numToCharRepresentation;
31:
32: CcsidManager(byte space, byte dot, byte[] numToCharRepresentation) {
33: this .space = space;
34: this .dot = dot;
35: this .numToCharRepresentation = numToCharRepresentation;
36: }
37:
38: // Convert a Java String into bytes for a particular ccsid.
39: //
40: // @param sourceString A Java String to convert.
41: // @return A new byte array representing the String in a particular ccsid.
42: abstract byte[] convertFromUCS2(String sourceString);
43:
44: // Convert a Java String into bytes for a particular ccsid.
45: // The String is converted into a buffer provided by the caller.
46: //
47: // @param sourceString A Java String to convert.
48: // @param buffer The buffer to convert the String into.
49: // @param offset Offset in buffer to start putting output.
50: // @return An int containing the buffer offset after conversion.
51: abstract int convertFromUCS2(String sourceString, byte[] buffer,
52: int offset);
53:
54: // Convert a byte array representing characters in a particular ccsid into a Java String.
55: //
56: // @param sourceBytes An array of bytes to be converted.
57: // @return String A new Java String Object created after conversion.
58: abstract String convertToUCS2(byte[] sourceBytes);
59:
60: // Convert a byte array representing characters in a particular ccsid into a Java String.
61: //
62: // @param sourceBytes An array of bytes to be converted.
63: // @param offset An offset indicating first byte to convert.
64: // @param numToConvert The number of bytes to be converted.
65: // @return A new Java String Object created after conversion.
66: abstract String convertToUCS2(byte[] sourceBytes, int offset,
67: int numToConvert);
68:
69: }
|