Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / drda / org / apache / derby / impl / drda / CcsidManager.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/drda/org/apache/derby/impl/drda/CcsidManager.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/drda/org/apache/derby/impl/drda/CcsidManager.java
new file mode 100644 (file)
index 0000000..b581ab9
--- /dev/null
@@ -0,0 +1,74 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.drda.CcsidManager\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+package org.apache.derby.impl.drda;\r
+\r
+// Peforms character conversions.\r
+abstract class CcsidManager\r
+{\r
+  byte space; // ' ' character\r
+  byte dot;   // '.' character\r
+\r
+  // Byte array used to convert numbers into\r
+  // bytes containing the character representation "value" for the particular ccsid.\r
+  byte[] numToCharRepresentation;\r
+\r
+  CcsidManager (byte space, byte dot, byte[] numToCharRepresentation)\r
+  {\r
+    this.space = space;\r
+    this.dot = dot;\r
+    this.numToCharRepresentation = numToCharRepresentation;\r
+  }\r
+\r
+\r
+  // Convert a Java String into bytes for a particular ccsid.\r
+  //\r
+  // @param sourceString A Java String to convert.\r
+  // @return A new byte array representing the String in a particular ccsid.\r
+  abstract byte[] convertFromUCS2 (String sourceString);\r
+\r
+\r
+  // Convert a Java String into bytes for a particular ccsid.\r
+  // The String is converted into a buffer provided by the caller.\r
+  //\r
+  // @param sourceString  A Java String to convert.\r
+  // @param buffer        The buffer to convert the String into.\r
+  // @param offset        Offset in buffer to start putting output.\r
+  // @return An int containing the buffer offset after conversion.\r
+  abstract int convertFromUCS2 (String sourceString,\r
+                                byte[] buffer,\r
+                                int offset);\r
+\r
+  // Convert a byte array representing characters in a particular ccsid into a Java String.\r
+  //\r
+  // @param sourceBytes An array of bytes to be converted.\r
+  // @return String A new Java String Object created after conversion.\r
+  abstract String convertToUCS2 (byte[] sourceBytes);\r
+\r
+\r
+  // Convert a byte array representing characters in a particular ccsid into a Java String.\r
+  //\r
+  // @param sourceBytes An array of bytes to be converted.\r
+  // @param offset  An offset indicating first byte to convert.\r
+  // @param numToConvert The number of bytes to be converted.\r
+  // @return A new Java String Object created after conversion.\r
+  abstract String convertToUCS2 (byte[] sourceBytes, int offset, int numToConvert);\r
+\r
+}\r