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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. import org.apache.commons.io.IOUtils;
  23. /*
  24. * !!! THIS IS A GENERATED FILE !!!
  25. * If updates to the source are needed, then:
  26. * - apply the necessary modifications to
  27. * 'src/codegen/unicode/java/org/apache/fop/text/bidi/GenerateBidiTestData.java'
  28. * - run 'ant codegen-unicode', which will generate a new BidiTestData.java
  29. * in 'test/java/org/apache/fop/complexscripts/bidi'
  30. * - commit BOTH changed files
  31. */
  32. /** Bidirectional test data. */
  33. public final class BidiTestData {
  34. private BidiTestData() {
  35. }
  36. public static final String TD_PFX = "TD";
  37. public static final int TD_CNT = 19;
  38. public static final String LD_PFX = "LD";
  39. public static final int LD_CNT = 622;
  40. public static final int NUM_TEST_SEQUENCES = 216357;
  41. public static int[] readTestData(String prefix, int index) {
  42. int[] data = null;
  43. InputStream is = null;
  44. Class btc = BidiTestData.class;
  45. String name = btc.getSimpleName() + "$" + prefix + index + ".ser";
  46. try {
  47. if ((is = btc.getResourceAsStream(name)) != null) {
  48. ObjectInputStream ois = new ObjectInputStream(is);
  49. data = (int[]) ois.readObject();
  50. ois.close();
  51. }
  52. } catch (IOException e) {
  53. data = null;
  54. } catch (ClassNotFoundException e) {
  55. data = null;
  56. } finally {
  57. IOUtils.closeQuietly(is);
  58. }
  59. return data;
  60. }
  61. }