You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BidiTestData.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id: License.java 1039179 2010-11-25 21:04:09Z vhennebert $ */
  18. package org.apache.fop.complexscripts.bidi;
  19. import java.io.IOException;
  20. import java.io.InputStream;
  21. import java.io.ObjectInputStream;
  22. /*
  23. * !!! THIS IS A GENERATED FILE !!!
  24. * If updates to the source are needed, then:
  25. * - apply the necessary modifications to
  26. * 'src/codegen/unicode/java/org/apache/fop/text/bidi/GenerateBidiTestData.java'
  27. * - run 'ant codegen-unicode', which will generate a new BidiTestData.java
  28. * in 'test/java/org/apache/fop/complexscripts/bidi'
  29. * - commit BOTH changed files
  30. */
  31. /** Bidirectional test data. */
  32. public final class BidiTestData {
  33. private BidiTestData() {
  34. }
  35. public static final String TD_PFX = "TD";
  36. public static final int TD_CNT = 19;
  37. public static final String LD_PFX = "LD";
  38. public static final int LD_CNT = 622;
  39. public static final int NUM_TEST_SEQUENCES = 216357;
  40. public static int[] readTestData(String prefix, int index) {
  41. int[] data = null;
  42. InputStream is = null;
  43. Class btc = BidiTestData.class;
  44. String name = btc.getSimpleName() + "$" + prefix + index + ".ser";
  45. try {
  46. if ((is = btc.getResourceAsStream(name)) != null) {
  47. ObjectInputStream ois = new ObjectInputStream(is);
  48. data = (int[]) ois.readObject();
  49. ois.close();
  50. }
  51. } catch (IOException e) {
  52. data = null;
  53. } catch (ClassNotFoundException e) {
  54. data = null;
  55. } finally {
  56. if (is != null) {
  57. try { is.close(); } catch (Exception e) { /* NOP */ }
  58. }
  59. }
  60. return data;
  61. }
  62. }