foray-commit Mailing List for FOray (Page 84)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
|
|
From: <vic...@us...> - 2021-01-15 17:26:37
|
Revision: 11794
http://sourceforge.net/p/foray/code/11794
Author: victormote
Date: 2021-01-15 17:26:35 +0000 (Fri, 15 Jan 2021)
Log Message:
-----------
Conform to aXSL change adding asPlus and asMutable to CharSequencePlus.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java 2021-01-15 17:00:27 UTC (rev 11793)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java 2021-01-15 17:26:35 UTC (rev 11794)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.CharSequenceMutable;
+import org.axsl.common.sequence.CharSequencePlus;
import java.io.Serializable;
import java.util.Arrays;
@@ -284,4 +285,14 @@
this.backingArray[index] = ch;
}
+ @Override
+ public CharSequencePlus asPlus() {
+ return this;
+ }
+
+ @Override
+ public CharSequenceMutable asMutable() {
+ return this;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-15 17:00:30
|
Revision: 11793
http://sourceforge.net/p/foray/code/11793
Author: victormote
Date: 2021-01-15 17:00:27 +0000 (Fri, 15 Jan 2021)
Log Message:
-----------
Conform to aXSL changes allowing Basic sequence implementations to cast themselves as Plus or Mutable.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -655,4 +655,9 @@
return byteAt(index);
}
+ @Override
+ public ByteSequencePlus asPlus() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -61,4 +61,9 @@
return new org.foray.common.data.IntSequenceIterator(this, true);
}
+ @Override
+ public IntSequencePlus asPlus() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -32,6 +32,7 @@
import org.foray.common.primitive.NumberUtils;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequenceMutable;
import java.io.Serializable;
import java.nio.charset.Charset;
@@ -235,4 +236,9 @@
return false;
}
+ @Override
+ public ByteSequenceMutable asMutable() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -405,4 +405,9 @@
return Arrays.binarySearch(this.backingArray, 0, length(), value);
}
+ @Override
+ public ByteSequenceMutable asMutable() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -32,6 +32,7 @@
import org.foray.common.primitive.NumberUtils;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequenceMutable;
import java.io.Serializable;
@@ -124,4 +125,9 @@
return ! (this.sequence instanceof String);
}
+ @Override
+ public ByteSequenceMutable asMutable() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequenceMutable;
import org.axsl.common.sequence.ByteSequencePlus;
/**
@@ -113,4 +114,9 @@
return new ByteArray(bytes);
}
+ @Override
+ public ByteSequenceMutable asMutable() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.IntSequence;
+import org.axsl.common.sequence.IntSequenceMutable;
import java.util.Arrays;
@@ -125,4 +126,9 @@
return this.intAt(index);
}
+ @Override
+ public IntSequenceMutable asMutable() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.IntSequence;
+import org.axsl.common.sequence.IntSequenceMutable;
import java.util.Arrays;
@@ -39,7 +40,7 @@
* <p>This class can also operate as a stack of primitive ints.
* The {@link #push(int)}, {@link #pop()}, and {@link #peek()} methods exist to support that use case.</p>
*/
-public class IntArrayBuilder extends AbstractIntSequence {
+public class IntArrayBuilder extends AbstractIntSequence implements IntSequenceMutable {
/** The initial size of the array of no initial size is specified. */
private static final int DEFAULT_INITIAL_SIZE = 10;
@@ -283,4 +284,9 @@
return intAt(index);
}
+ @Override
+ public IntSequenceMutable asMutable() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.LongSequence;
+import org.axsl.common.sequence.LongSequenceMutable;
import org.axsl.common.sequence.LongSequencePlus;
import java.util.Arrays;
@@ -126,4 +127,14 @@
return this.longAt(index);
}
+ @Override
+ public LongSequencePlus asPlus() {
+ return this;
+ }
+
+ @Override
+ public LongSequenceMutable asMutable() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 17:00:27 UTC (rev 11793)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.LongSequence;
+import org.axsl.common.sequence.LongSequenceMutable;
import org.axsl.common.sequence.LongSequencePlus;
import java.util.Arrays;
@@ -40,7 +41,7 @@
* <p>This class can also operate as a stack of primitive longs.
* The {@link #push(long)}, {@link #pop()}, and {@link #peek()} methods exist to support that use case.</p>
*/
-public class LongArrayBuilder implements LongSequencePlus {
+public class LongArrayBuilder implements LongSequenceMutable {
/** The initial size of the array of no initial size is specified. */
private static final int DEFAULT_INITIAL_SIZE = 10;
@@ -284,4 +285,14 @@
return longAt(index);
}
+ @Override
+ public LongSequencePlus asPlus() {
+ return this;
+ }
+
+ @Override
+ public LongSequenceMutable asMutable() {
+ return this;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-15 15:01:25
|
Revision: 11792
http://sourceforge.net/p/foray/code/11792
Author: victormote
Date: 2021-01-15 15:01:17 +0000 (Fri, 15 Jan 2021)
Log Message:
-----------
Conform to move of Plus and Mutable interfaces for array wrappers from FOray to aXSL.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfCrossRefEntry.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfParser.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -31,6 +31,7 @@
import org.foray.common.primitive.ByteUtils;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequencePlus;
import java.io.IOException;
import java.io.OutputStream;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractIntSequence.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -28,6 +28,8 @@
package org.foray.common.data;
+import org.axsl.common.sequence.IntSequencePlus;
+
/**
* Abstract superclass for implementations of {@link IntSequencePlus}.
*/
@@ -51,12 +53,12 @@
@Override
public IntSequenceIterator iterator() {
- return new IntSequenceIterator(this);
+ return new org.foray.common.data.IntSequenceIterator(this);
}
@Override
public IntSequenceIterator iteratorReverse() {
- return new IntSequenceIterator(this, true);
+ return new org.foray.common.data.IntSequenceIterator(this, true);
}
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -215,7 +215,7 @@
return Arrays.copyOf(this.array, this.array.length);
}
- @Override
+// @Override
public ByteArray toByteArray() {
return this;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -34,6 +34,8 @@
package org.foray.common.data;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequenceMutable;
+import org.axsl.common.sequence.ByteSequencePlus;
import org.apache.commons.io.IOUtils;
@@ -344,7 +346,7 @@
return Arrays.copyOf(this.backingArray, this.nextIndex);
}
- @Override
+// @Override
public ByteArray toByteArray() {
return new ByteArray(toArray());
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -98,7 +98,7 @@
throw new UnsupportedOperationException();
}
- @Override
+// @Override
public ByteArray toByteArray() {
/* TODO: Implement this. */
throw new UnsupportedOperationException();
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,56 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision: 11416 $
- * $LastChangedDate: 2019-02-14 08:11:46 -0700 (Thu, 14 Feb 2019) $
- * $LastChangedBy: victormote $
- */
-
-package org.foray.common.data;
-
-/**
- * A mutable byte sequence.
- */
-public interface ByteSequenceMutable extends ByteSequencePlus {
-
- /**
- * Sorts the specified array into ascending numerical order.
- * @see java.util.Arrays#sort(byte[])
- */
- void sort();
-
- /**
- * <p>Pass-through call {@link java.util.Arrays#binarySearch(byte[], byte)}.
- * Performs a binary search to find a given value in this sequence.
- * This sequence must be first sorted for this to be effective.</p>
- * <p>Development Note: Since this is a read-only method, it is tempting to think that this method should be
- * included in {@link ByteSequencePlus}.
- * However, binary search requires that the content first be sorted, which cannot be guaranteed with immutable
- * objects.</p>
- * @param value The value searched for.
- * @return Same as for {@link java.util.Arrays#binarySearch(byte[], byte)}.
- * @see java.util.Arrays#binarySearch(byte[], byte)
- */
- int binarySearch(byte value);
-
-}
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,692 +0,0 @@
-/*
- * Copyright 2020 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common.data;
-
-import org.axsl.common.sequence.ByteSequence;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.nio.charset.Charset;
-
-/**
- * Sub-interface of {@link ByteSequence} whose implementations provide additional read-only services.
- * All methods in this interface must be read-only.
- */
-public interface ByteSequencePlus extends ByteSequence {
-
- /**
- * Returns an array containing the {@link Byte#TYPE}s in this sequence in the same order as this sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of {@link Byte#TYPE}s.
- */
- byte[] toArray();
-
- /**
- * Convenience method that returns the value of the last element in this sequence.
- * @return The value of the last byte in this sequence.
- */
- byte lastByte();
-
- /**
- * Returns a new {@link CharSequence} that is a subsequence of this sequence, using the US_ASCII Charset.
- * The subsequence starts with the {@code byte} value at index {@code start} and ends with the {@code byte} value at
- * index {@code end - 1}.
- * The length of the returned sequence is {@code end - @code start}, so if {@code start == @code end} then an empty
- * sequence is returned.
- * @param start The start index, inclusive.
- * @param end The end index, exclusive.
- * @return The specified subsequence.
- */
- CharSequence charSubSequence(int start, int end);
-
- /**
- * Returns a new {@link CharSequence} that is a subsequence of this sequence, using the specified Charset.
- * The subsequence starts with the {@code byte} value at index {@code start} and ends with the {@code byte} value at
- * index {@code end - 1}.
- * The length of the returned sequence is {@code end - @code start}, so if {@code start == @code end} then an empty
- * sequence is returned.
- * @param start The start index, inclusive.
- * @param end The end index, exclusive.
- * @param charset The charset to use when converting the bytes in this sequence to the chars in the returned
- * sequence.
- * @return The specified subsequence.
- */
- CharSequence charSubSequence(int start, int end, Charset charset);
-
- /**
- * Returns a new {@link CharSequence} that is a subsequence of this sequence, using the specified Charset.
- * The subsequence starts with the {@code byte} value at index {@code start} and ends with the {@code byte} value at
- * index {@code end - 1}.
- * The length of the returned sequence is {@code end - @code start}, so if {@code start == @code end} then an empty
- * sequence is returned.
- * @param start The start index, inclusive.
- * @param end The end index, exclusive.
- * @param charsetName The name of the charset to use when converting the bytes in this sequence to the chars in the
- * returned sequence.
- * @return The specified subsequence.
- * @throws UnsupportedEncodingException If the named charset is not supported.
- */
- CharSequence charSubSequence(int start, int end, String charsetName) throws UnsupportedEncodingException;
-
- /**
- * Indicates whether this sequence contains a given byte value.
- * @param testByte The byte value to be tested.
- * @return True if and only if this sequence contains at least one occurrence of {@code testByte}.
- */
- boolean contains(byte testByte);
-
- /**
- * Indicates whether this instance wraps a native {@link String} or other {@link CharSequence} instance.
- * @return True if and only if this instance wraps a native {@link String} or other {@link CharSequence} instance.
- * @see #getNativeCharSequence()
- */
- boolean isNativeCharSequence();
-
- /**
- * Returns the wrapped {@link String} or other {@link CharSequence} instance, if any.
- * @return For instances that wrap a native {@link String} or other {@link CharSequence} instance, returns that
- * instance. For all other instances, returns null.
- * @see #isNativeCharSequence()
- */
- CharSequence getNativeCharSequence();
-
- /**
- * Indicates whether this instance is mutable, i.e. whether its content can be changed after it has been created.
- * @return True if and only if this instance <em>can </em>be changed after it has been created.
- */
- boolean isMutable();
-
- /**
- * Indicates whether this byte sequence is parseable as a {@link Byte#TYPE}.
- * @return True if and only if calling {@link #parseByte()} will succeed without throwing a
- * {@link NumberFormatException}.
- */
- boolean canParseByte();
-
- /**
- * Parses the bytes in this sequence as the string representation of decimal digits.
- * This method should return the same value and throw the same exceptions as {@link Byte#parseByte(String)}, where
- * the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @return The parsed byte.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Byte#TYPE}.
- * To avoid this exception, call {@link #canParseByte()} first.
- * @see Byte#parseByte(String)
- */
- byte parseByte();
-
- /**
- * Parses the bytes in this sequence as the string representation of digits of a specified radix.
- * This method should return the same value and throw the same exceptions as {@link Byte#parseByte(String, int)},
- * where the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @param radix The radix to be used while parsing this.
- * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value
- * to 16.
- * @return The parsed byte.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Byte#TYPE} for
- * {@code radix}.
- * @see Byte#parseByte(String, int)
- */
- byte parseByte(int radix);
-
- /**
- * Indicates whether this byte sequence is parseable as a {@link Short#TYPE}.
- * @return True if and only if calling {@link #parseShort()} will succeed without throwing a
- * {@link NumberFormatException}.
- */
- boolean canParseShort();
-
- /**
- * Parses the bytes in this sequence as the string representation of decimal digits.
- * This method should return the same value and throw the same exceptions as {@link Short#parseShort(String)}, where
- * the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @return The parsed short.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Short#TYPE}.
- * To avoid this exception, call {@link #canParseShort()} first.
- * @see Short#parseShort(String)
- */
- short parseShort();
-
- /**
- * Parses the bytes in this sequence as the string representation of digits of a specified radix.
- * This method should return the same value and throw the same exceptions as {@link Short#parseShort(String, int)},
- * where the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @param radix The radix to be used while parsing this.
- * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value
- * to 16.
- * @return The parsed short.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Short#TYPE} for
- * {@code radix}.
- * @see Short#parseShort(String, int)
- */
- short parseShort(int radix);
-
- /**
- * Indicates whether this byte sequence is parseable as a {@link Integer#TYPE}.
- * @return True if and only if calling {@link #parseInt()} will succeed without throwing a
- * {@link NumberFormatException}.
- */
- boolean canParseInt();
-
- /**
- * Parses the bytes in this sequence as the string representation of decimal digits.
- * This method should return the same value and throw the same exceptions as {@link Integer#parseInt(String)}, where
- * the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @return The parsed int.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Integer#TYPE}.
- * To avoid this exception, call {@link #canParseInt()} first.
- * @see Integer#parseInt(String)
- */
- int parseInt();
-
- /**
- * Parses the bytes in this sequence as the string representation of digits of a specified radix.
- * This method should return the same value and throw the same exceptions as {@link Integer#parseInt(String, int)},
- * where the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @param radix The radix to be used while parsing this.
- * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value
- * to 16.
- * @return The parsed int.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Integer#TYPE} for
- * {@code radix}.
- * @see Integer#parseInt(String, int)
- */
- int parseInt(int radix);
-
- /**
- * Indicates whether this byte sequence is parseable as a {@link Long#TYPE}.
- * @return True if and only if calling {@link #parseLong()} will succeed without throwing a
- * {@link NumberFormatException}.
- */
- boolean canParseLong();
-
- /**
- * Parses the bytes in this sequence as the string representation of decimal digits.
- * This method should return the same value and throw the same exceptions as {@link Long#parseLong(String)}, where
- * the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @return The parsed long.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Long#TYPE}.
- * To avoid this exception, call {@link #canParseLong()} first.
- * @see Long#parseLong(String)
- */
- long parseLong();
-
- /**
- * Parses the bytes in this sequence as the string representation of digits of a specified radix.
- * This method should return the same value and throw the same exceptions as {@link Long#parseLong(String, int)},
- * where the {@link String} is the result of this.{@link #toString()}.
- * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion.
- * @param radix The radix to be used while parsing this.
- * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value
- * to 16.
- * @return The parsed long.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Long#TYPE} for
- * {@code radix}.
- * @see Long#parseLong(String, int)
- */
- long parseLong(int radix);
-
- /**
- * Indicates whether this byte sequence is parseable as a {@link BigDecimal}.
- * @return True if and only if calling {@link #parseDecimal()} will succeed without throwing a
- * {@link NumberFormatException}.
- */
- boolean canParseDecimal();
-
- /**
- * Parses the bytes in this sequence as the string representation of decimal digits.
- * This method should return the same value and throw the same exceptions as
- * {@link BigDecimal#BigDecimal(String)}, where the {@link String} is the result of this.{@link #toString()}.
- * Implementations may or may not use that constructor to create the instance.
- * @return The parsed decimal.
- * @throws NumberFormatException If the byte sequence does not contain a parsable {@link BigDecimal}.
- * To avoid this exception, call {@link #canParseDecimal()} first.
- */
- BigDecimal parseDecimal();
-
- /**
- * Reads all content from a given index to, but not including, the next carriage-return or linefeed byte(s).
- * @param start The starting index from which to read.
- * @return A new ByteSequence containing the content that was read, or null if at the end of the file.
- */
- ByteSequencePlus readCurrentLine(int start);
-
- /**
- * Reads all content from the start of the next line (i.e. the first byte after the next end-of-line byte/bytes)
- * to, but not including, the next carriage-return or linefeed character.
- * @param start The starting index from which to read.
- * @return A new ByteSequence containing the content that was read. This sequence can have a size of zero
- * if {@code start} is positioned at the end of a line or at the end of file.
- */
- ByteSequencePlus readNextLine(int start);
-
- /**
- * Returns the next word after a given index.
- * "Word" is defined as the next sequence of non-whitespace characters.
- * Whitespace characters are defined as a space, linefeed, carriage return, or tab.
- * Any leading or trailing whitespace characters are omitted.
- * @param start The index at which the word should be sought.
- * @return The next word, or null if no word can be found.
- */
- ByteSequencePlus readWord(int start);
-
- /**
- * Returns the nth word after a given index.
- * @param start The index at which the word should be sought.
- * @param sequence The number of the word found that should be returned.
- * The number of words skipped is (sequence - 1).
- * For example, if sequence is 3, 2 words will be skipped, and the 3rd word will be returned.
- * If sequence is less than 1, it will be ignored.
- * @return The next word, or null if no word can be found.
- * @see #readWord(int)
- */
- ByteSequencePlus readWord(int start, int sequence);
-
- /**
- * Returns the index within this sequence of the first occurrence of {@code aByte}.
- * If a byte with value {@code ch} occurs in the byte sequence represented by this object, then the index of the
- * first such occurrence is returned.
- * If no such byte occurs in this sequence, then {@code -1} is returned.
- *
- * @param aByte The byte whose location is sought.
- * @return The index of the first occurrence of {@code aByte} in the sequence represented by this object, or
- * {@code -1} if that value does not occur.
- * @see java.lang.String#indexOf(int)
- */
- int indexOf(int aByte);
-
- /**
- * Returns the index within this string of the first occurrence of {@code aByte}, starting the search at the
- * specified index.
- * <p>
- * If a byte with value {@code aByte} occurs in the sequence represented by this object at an index no smaller than
- * {@code fromIndex}, then the index of the first such occurrence is returned.
- * If no such byte occurs in this string at or after position {@code fromIndex}, then {@code -1} is returned.
- * <p>
- * There is no restriction on the value of {@code fromIndex}.
- * If it is negative, it has the same effect as if it were zero: this entire string may be searched.
- * If it is greater than the length of this string, it has the same effect as if it were equal to the length of
- * this string: {@code -1} is returned.
- *
- * @param aByte The byte whose location is sought.
- * @param fromIndex the index to start the search from.
- * @return The index of the first occurrence of {@code aByte} in the sequence represented by this object that is
- * greater than or equal to {@code fromIndex}, or {@code -1} if that value does not occur.
- * @see java.lang.String#indexOf(int, int)
- */
- int indexOf(int aByte, int fromIndex);
-
- /**
- * Returns the index within this string of the first occurrence of the
- * specified substring.
- *
- * <p>The returned index is the smallest value <i>k</i> for which:
- * <blockquote><pre>
- * this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @return the index of the first occurrence of the specified substring,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#indexOf(java.lang.String)
- */
- int indexOf(CharSequence str);
-
- /**
- * Returns the index within this string of the first occurrence of the
- * specified substring, starting at the specified index.
- *
- * <p>The returned index is the smallest value <i>k</i> for which:
- * <blockquote><pre>
- * <i>k</i> >= fromIndex {@code &&} this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @param fromIndex the index from which to start the search.
- * @return the index of the first occurrence of the specified substring,
- * starting at the specified index,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#indexOf(java.lang.String, int)
- */
- int indexOf(CharSequence str, int fromIndex);
-
- /**
- * Code shared by String and AbstractStringBuilder to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param fromIndex the index to begin searching from.
- * @return The index where {@code target} was found, or -1 if not found.
- */
- int indexOf(int sourceOffset, int sourceCount, CharSequence target, int fromIndex);
-
- /**
- * Code shared by String and StringBuffer to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param targetOffset offset of the target string.
- * @param targetCount count of the target string.
- * @param fromIndex the index to begin searching from.
- * @return The index where {@code target} was found, or -1 if not found.
- */
- int indexOf(int sourceOffset, int sourceCount, CharSequence target, int targetOffset, int targetCount,
- int fromIndex);
-
- /**
- * Returns the index within this string of the first occurrence of the specified substring.
- *
- * <p>The returned index is the smallest value <i>k</i> for which:
- * <blockquote><pre>
- * this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @return the index of the first occurrence of the specified substring,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#indexOf(java.lang.String)
- */
- int indexOf(ByteSequence str);
-
- /**
- * Returns the index within this string of the first occurrence of the specified substring, starting at the
- * specified index.
- *
- * <p>The returned index is the smallest value <i>k</i> for which:
- * <blockquote><pre>
- * <i>k</i> >= fromIndex {@code &&} this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @param fromIndex the index from which to start the search.
- * @return the index of the first occurrence of the specified substring,
- * starting at the specified index,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#indexOf(java.lang.String, int)
- */
- int indexOf(ByteSequence str, int fromIndex);
-
- /**
- * Searches for one sequence in another.
- * The source is the character array being searched, and the target is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param fromIndex the index to begin searching from.
- * @return The index where {@code target} was found, or -1 if not found.
- */
- int indexOf(int sourceOffset, int sourceCount, ByteSequence target, int fromIndex);
-
- /**
- * Searches for one sequence in another.
- * The source is the character array being searched, and the target is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param targetOffset offset of the target string.
- * @param targetCount count of the target string.
- * @param fromIndex the index to begin searching from.
- * @return The index where {@code target} was found, or -1 if not found.
- */
- int indexOf(int sourceOffset, int sourceCount, ByteSequence target, int targetOffset, int targetCount,
- int fromIndex);
-
- /**
- * Returns the index within this byte sequence of the last occurrence of the specified byte.
- * If no such byte occurs in this byte sequence, then {@code -1} is returned.
- * This byte sequence is searched backwards starting at the last character.
- *
- * @param aByte The byte being sought.
- * @return The index of the last occurrence of {@code aByte} in the byte sequence represented by this object, or
- * {@code -1} if the byte does not occur.
- * @see java.lang.String#lastIndexOf(int)
- */
- int lastIndexOf(int aByte);
-
- /**
- * Returns the index within this byte sequence of the last occurrence of the specified byte, searching backward
- * starting at the specified index.
- * If no such byte occurs in this byte sequence at or before position {@code fromIndex}, then {@code -1} is
- * returned.
- *
- * @param aByte The byte whose location is being sought.
- * @param fromIndex The index from which to start the search.
- * There is no restriction on the value of {@code fromIndex}.
- * If it is greater than or equal to the length of this string, it has the same effect as if it were equal to one
- * less than the length of this string: this entire string may be searched.
- * If it is negative, it has the same effect as if it were -1: -1 is returned.
- * @return The index of the last occurrence of the character in this byte sequence that is less than or equal to
- * {@code fromIndex}, or {@code -1} if the character does not occur before that point.
- * @see java.lang.String#lastIndexOf(int, int)
- */
- int lastIndexOf(int aByte, int fromIndex);
-
- /**
- * Returns the index within this byte sequence of the last occurrence of the specified substring.
- * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}.
- *
- * <p>The returned index is the largest value <i>k</i> for which:
- * <blockquote><pre>
- * this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @return the index of the last occurrence of the specified substring,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#lastIndexOf(java.lang.String)
- */
- int lastIndexOf(CharSequence str);
-
- /**
- * Returns the index within this string of the last occurrence of the
- * specified substring, searching backward starting at the specified index.
- *
- * <p>The returned index is the largest value <i>k</i> for which:
- * <blockquote><pre>
- * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @param fromIndex the index to start the search from.
- * @return the index of the last occurrence of the specified substring,
- * searching backward from the specified index,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#lastIndexOf(java.lang.String, int)
- */
- int lastIndexOf(CharSequence str, int fromIndex);
-
- /**
- * Code shared by String and AbstractStringBuilder to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param fromIndex the index to begin searching from.
- * @return The index, or -1 if not found.
- */
- int lastIndexOf(int sourceOffset, int sourceCount, CharSequence target, int fromIndex);
-
- /**
- * Code shared by String and StringBuffer to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param targetOffset offset of the target string.
- * @param targetCount count of the target string.
- * @param fromIndex the index to begin searching from.
- * @return The index, or -1 if not found.
- */
- int lastIndexOf(int sourceOffset, int sourceCount, CharSequence target, int targetOffset, int targetCount,
- int fromIndex);
-
- /**
- * Returns the index within this byte sequence of the last occurrence of the specified substring.
- * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}.
- *
- * <p>The returned index is the largest value <i>k</i> for which:
- * <blockquote><pre>
- * this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @return the index of the last occurrence of the specified substring,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#lastIndexOf(java.lang.String)
- */
- int lastIndexOf(ByteSequence str);
-
- /**
- * Returns the index within this string of the last occurrence of the
- * specified substring, searching backward starting at the specified index.
- *
- * <p>The returned index is the largest value <i>k</i> for which:
- * <blockquote><pre>
- * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(str, <i>k</i>)
- * </pre></blockquote>
- * If no such value of <i>k</i> exists, then {@code -1} is returned.
- *
- * @param str the substring to search for.
- * @param fromIndex the index to start the search from.
- * @return the index of the last occurrence of the specified substring,
- * searching backward from the specified index,
- * or {@code -1} if there is no such occurrence.
- * @see java.lang.String#lastIndexOf(java.lang.String, int)
- */
- int lastIndexOf(ByteSequence str, int fromIndex);
-
- /**
- * Code shared by String and AbstractStringBuilder to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param fromIndex the index to begin searching from.
- * @return The index, or -1 if not found.
- */
- int lastIndexOf(int sourceOffset, int sourceCount, ByteSequence target, int fromIndex);
-
- /**
- * Code shared by String and StringBuffer to do searches. The
- * source is the character array being searched, and the target
- * is the string being searched for.
- *
- * @param sourceOffset offset of the source string.
- * @param sourceCount count of the source string.
- * @param target the characters being searched for.
- * @param targetOffset offset of the target string.
- * @param targetCount count of the target string.
- * @param fromIndex the index to begin searching from.
- * @return The index, or -1 if not found.
- */
- int lastIndexOf(int sourceOffset, int sourceCount, ByteSequence target, int targetOffset, int targetCount,
- int fromIndex);
-
- /**
- * Returns this object as a ByteArray.
- * @return A ByteArray containing the same bytes as this instance.
- */
- ByteArray toByteArray();
-
- /**
- * Compares this object with another and reports on differences.
- * @param other The object to which this should be compared.
- * @return A message reporting on differences, or an empty String if the two objects are equal.
- */
- String difference(Object other);
-
- /**
- * Counts the number of whitespace characters starting at a given location and ending at the first non-whitespace
- * character found.
- * @param start The starting index.
- * @return The number of whitespace bytes including and immediately following the byte at {@code index}.
- */
- int countWhitespace(int start);
-
- /**
- * Returns the first index, at or after a given starting index, that is either at the start of the file
- * or is immediately preceded by an end-of-line character or set of characters.
- * @param start The index at which to start looking for the new line.
- * @return The index to the start of the next line, or -1 if no start of a new line is found.
- */
- int findStartOfLine(int start);
-
- /**
- * Indicates whether the byte at a given index is the start of a new line, i.e. is either at the start of the file
- * or is immediately preceded by an end-of-line character or set of characters.
- * @param start The index for the byte to test.
- * @return True if and only if {@code start} is the beginning of a new line.
- */
- boolean isStartOfLine(int start);
-
- /**
- * Writes the bytes in this sequence to an output stream.
- * @param output The output stream to which the bytes should be written.
- * @throws IOException For errors writing to {@code output}.
- */
- void writeTo(OutputStream output) throws IOException;
-
- /**
- * Creates a ByteSequencePlus instance containing the ASCII hex characters representing the bytes in this sequence.
- * For example, if this instance is 0x32F9, this method should return the bytes "32F9" or 0x33_32_46_39.
- * @return A byte array containing the ASCII hexadecimal characters representing the bytes in this sequence.
- * Every byte in the returned array will be in the range 0-9 or A-F.
- */
- ByteSequencePlus toHexByteSequence();
-
-}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -29,6 +29,7 @@
package org.foray.common.data;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequencePlus;
/**
* A wrapper around another {@link ByteSequence}, providing a view of a subset of that sequence.
@@ -106,7 +107,7 @@
return array.subSequence(start, end);
}
- @Override
+// @Override
public ByteArray toByteArray() {
final byte[] bytes = toArray();
return new ByteArray(bytes);
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -31,6 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.ByteSequencePlus;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -28,6 +28,8 @@
package org.foray.common.data;
+import org.axsl.common.sequence.CharSequenceMutable;
+
import java.io.Serializable;
import java.util.Arrays;
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,75 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision: 11416 $
- * $LastChangedDate: 2019-02-14 08:11:46 -0700 (Thu, 14 Feb 2019) $
- * $LastChangedBy: victormote $
- */
-
-package org.foray.common.data;
-
-/**
- * A mutable char sequence.
- * Implementations of this class will have some similarities with {@link StringBuilder}.
- * However, {@link StringBuilder} cannot be made to conform to this interface, and, as it is a final class, it cannot
- * be subclassed to conform to this interface either.
- * That said, this interface should attempt to conform to the naming conventions used in that class.
- */
-public interface CharSequenceMutable extends CharSequencePlus {
-
- /**
- * The character at the specified index is set to {@code ch}.
- * This sequence is altered to represent a new character sequence that is identical to the old character sequence,
- * except that it contains the character {@code ch} at position {@code index}.
- * <p>
- *
- *
- * @param index The index of the character to modify. This must be greater than or equal to {@code 0}, and less than
- * the length of this sequence.
- * @param ch The new character.
- * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}.
- * @see java.lang.AbstractStringBuilder#setCharAt(int, char)
- */
- void setCharAt(int index, char ch);
-
- /**
- * Sorts the specified array into ascending numerical order.
- * @see java.util.Arrays#sort(byte[])
- */
- void sort();
-
- /**
- * <p>Pass-through call to {@link java.util.Arrays#binarySearch(char[], char)}.
- * Performs a binary search to find a given value in this sequence.
- * This sequence must be first sorted for this to be effective.</p>
- * <p>Development Note: Since this is a read-only method, it is tempting to think that this method should be
- * included in {@link CharSequencePlus}.
- * However, binary search requires that the content first be sorted, which cannot be guaranteed with immutable
- * objects.</p>
- * @param value The value searched for.
- * @return Same as for {@link java.util.Arrays#binarySearch(char[], char)}.
- * @see java.util.Arrays#binarySearch(char[], char)
- */
- int binarySearch(char value);
-
-}
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,65 +0,0 @@
-/*
- * Copyright 2020 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-
-package org.foray.common.data;
-
-/**
- * Sub-interface of {@link CharSequence} whose implementations provide additional read-only services.
- * All methods in this interface must be read-only.
- */
-public interface CharSequencePlus extends CharSequence {
-
- /**
- * Convenience method that returns the value of the last element in this sequence.
- * @return The value of the last byte in this sequence.
- */
- char lastChar();
-
- /**
- * Returns a copy of the internal array containing the {@code bytes}s in this sequence in the same order as this
- * sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of bytes.
- */
- char[] toArray();
-
- /**
- * Indicates whether this sequence contains a given char value.
- * @param testChar The char value to be tested.
- * @return True if and only if this sequence contains at least one occurrence of {@code testChar}.
- */
- boolean contains(char testChar);
-
- /**
- * Indicates whether this instance is mutable, i.e. whether its content can be changed after it has been created.
- * @return True if and only if this instance <em>can </em>be changed after it has been created.
- */
- boolean isMutable();
-
-}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -35,7 +35,7 @@
/**
* Iterates an instance of {@link IntSequence}.
*/
-public class IntSequenceIterator {
+public class IntSequenceIterator implements org.axsl.common.sequence.IntSequenceIterator {
/** The sequence being iterated. */
private IntSequence sequence;
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,77 +0,0 @@
-/*
- * Copyright 2020 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common.data;
-
-import org.axsl.common.sequence.IntSequence;
-
-/**
- * Sub-interface of {@link IntSequence} providing additional services.
- */
-public interface IntSequencePlus extends IntSequence {
-
- /**
- * Returns an array containing the {@link Integer#TYPE}s in this sequence in the same order as this sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of {@link Integer#TYPE}s.
- */
- int[] toArray();
-
- /**
- * Returns the index within this sequence of the first occurrence of {@code anInt}.
- * If an int with value {@code anInt} occurs in the sequence represented by this object, then the index of the
- * first such occurrence is returned.
- * If no such byte occurs in this sequence, then {@code -1} is returned.
- *
- * @param anInt The int whose location is sought.
- * @return The index of the first occurrence of {@code anInt} in the sequence represented by this object, or
- * {@code -1} if that value does not occur.
- * @see java.lang.String#indexOf(int)
- */
- int indexOf(int anInt);
-
- /**
- * Indicates whether this sequence contains a given int.
- * @param theInt The int being tested.
- * @return True if and only if this sequence contains at least one instance of {@code theInt}.
- */
- boolean contains(int theInt);
-
- /**
- * Returns an iterator over this sequence.
- * @return A new iterator.
- */
- IntSequenceIterator iterator();
-
- /**
- * Returns an iterator over this sequence that returns the elements in reverse order.
- * @return A new iterator.
- */
- IntSequenceIterator iteratorReverse();
-
-}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -28,9 +28,8 @@
package org.foray.common.data;
-import org.foray.common.sequence.LongSequencePlus;
-
import org.axsl.common.sequence.LongSequence;
+import org.axsl.common.sequence.LongSequencePlus;
import java.util.Arrays;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -28,9 +28,8 @@
package org.foray.common.data;
-import org.foray.common.sequence.LongSequencePlus;
-
import org.axsl.common.sequence.LongSequence;
+import org.axsl.common.sequence.LongSequencePlus;
import java.util.Arrays;
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common.sequence;
-
-import org.axsl.common.sequence.BooleanSequence;
-
-/**
- * Sub-interface of {@link BooleanSequence} whose implementations provide additional read-only services.
- * All methods in this interface must be read-only.
- */
-public interface BooleanSequencePlus extends BooleanSequence {
-
- /**
- * Returns an array containing the {@link Boolean#TYPE}s in this sequence in the same order as this sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of {@link Boolean#TYPE}s.
- */
- boolean[] toArray();
-
-}
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common.sequence;
-
-import org.axsl.common.sequence.LongSequence;
-
-/**
- * Sub-interface of {@link LongSequence} whose implementations provide additional read-only services.
- * All methods in this interface must be read-only.
- */
-public interface LongSequencePlus extends LongSequence {
-
- /**
- * Returns an array containing the {@link Long#TYPE}s in this sequence in the same order as this sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of {@link Long#TYPE}s.
- */
- long[] toArray();
-
-}
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java 2021-01-15 15:01:17 UTC (rev 11792)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governi...
[truncated message content] |
|
From: <vic...@us...> - 2021-01-15 14:33:38
|
Revision: 11791
http://sourceforge.net/p/foray/code/11791
Author: victormote
Date: 2021-01-15 14:33:34 +0000 (Fri, 15 Jan 2021)
Log Message:
-----------
Conform to aXSL move of the primitive array wrappers to their own package.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
trunk/foray/foray-common/src/test/java/org/foray/common/data/ByteSequenceTokenizerTests.java
trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfParser.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfBoolean.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfGenericStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfTextString.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java
trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractByteSequence.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.primitive.ByteUtils;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.io.IOException;
import java.io.OutputStream;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.ByteUtils;
import org.foray.common.primitive.NumberUtils;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.io.Serializable;
import java.nio.charset.Charset;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -33,7 +33,7 @@
package org.foray.common.data;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.apache.commons.io.IOUtils;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceChars.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharacterUtils;
import org.foray.common.primitive.NumberUtils;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.io.Serializable;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.io.IOException;
import java.io.OutputStream;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceSubset.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
/**
* A wrapper around another {@link ByteSequence}, providing a view of a subset of that sequence.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.WellKnownConstants;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArray.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.IntSequence;
+import org.axsl.common.sequence.IntSequence;
import java.util.Arrays;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.IntSequence;
+import org.axsl.common.sequence.IntSequence;
import java.util.Arrays;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequenceIterator.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.IntSequence;
+import org.axsl.common.sequence.IntSequence;
import java.util.NoSuchElementException;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.data;
-import org.axsl.common.data.IntSequence;
+import org.axsl.common.sequence.IntSequence;
/**
* Sub-interface of {@link IntSequence} providing additional services.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.sequence.LongSequencePlus;
-import org.axsl.common.data.LongSequence;
+import org.axsl.common.sequence.LongSequence;
import java.util.Arrays;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.sequence.LongSequencePlus;
-import org.axsl.common.data.LongSequence;
+import org.axsl.common.sequence.LongSequence;
import java.util.Arrays;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.sequence;
-import org.axsl.common.data.BooleanSequence;
+import org.axsl.common.sequence.BooleanSequence;
/**
* Sub-interface of {@link BooleanSequence} whose implementations provide additional read-only services.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.sequence;
-import org.axsl.common.data.LongSequence;
+import org.axsl.common.sequence.LongSequence;
/**
* Sub-interface of {@link LongSequence} whose implementations provide additional read-only services.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.common.sequence;
-import org.axsl.common.data.ShortSequence;
+import org.axsl.common.sequence.ShortSequence;
/**
* Sub-interface of {@link ShortSequence} whose implementations provide additional read-only services.
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/data/ByteSequenceTokenizerTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/data/ByteSequenceTokenizerTests.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/data/ByteSequenceTokenizerTests.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.WellKnownConstants;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.junit.Assert;
import org.junit.Test;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,8 +31,8 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.format.Kerning;
-import org.axsl.common.data.IntSequence;
import org.axsl.common.i18n.Orthography;
+import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
import org.axsl.ps.CharSet;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -38,9 +38,9 @@
import org.foray.font.format.ttf.TtfTableGsub;
import org.foray.font.format.type1.Type1Font;
-import org.axsl.common.data.ByteSequence;
-import org.axsl.common.data.IntSequence;
import org.axsl.common.i18n.Orthography;
+import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontException;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -33,7 +33,7 @@
import org.foray.font.format.FontParser;
import org.foray.font.format.FontParserClient;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.font.FontException;
import org.axsl.ps.PsException;
import org.axsl.ps.PsFontDictionary;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,8 +31,8 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.IntArray;
-import org.axsl.common.data.IntSequence;
import org.axsl.common.i18n.Orthography;
+import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
import org.axsl.font.Panose;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -36,7 +36,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -33,7 +33,7 @@
import org.foray.common.data.ByteArray;
import org.foray.common.ps.BoundingBox4a;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.PsBoundingBox;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -33,7 +33,7 @@
import org.foray.graphic.factory.GraphicFactory;
import org.foray.graphic.output.GraphicOutputFactory;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutput;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -38,7 +38,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.Mime;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.Mime;
import org.foray.graphic.batik.BatikUaAwt;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.GraphicLink;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -36,7 +36,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfParser.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfParser.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfParser.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -49,7 +49,7 @@
import org.foray.pdf.object.PdfTextString;
import org.foray.pdf.object.PdfTrailer;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.pdf.PdfException;
import org.axsl.pdf.PdfVersion;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfBoolean.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfBoolean.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfBoolean.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
/**
* A PDF boolean.
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.font.FontUse;
import org.axsl.pdf.PdfException;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfGenericStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfGenericStream.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfGenericStream.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.pdf.PdfException;
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.pdf.PdfException;
import org.axsl.ps.PsEncodeFilter;
import org.axsl.ps.PsFilterType;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfTextString.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfTextString.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfTextString.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteSequenceChars;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
/**
* A PDF Text String, as defined in PDF Reference, 2nd Edition, Section 3.8.1.
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.ps.BoundingBox4a;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.pdf.PdfException;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.ps.PsInput;
import java.io.File;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.ps.PsInput;
import java.io.File;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -30,7 +30,7 @@
import org.foray.common.data.ByteArray;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.ps.PsInput;
/**
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -38,7 +38,7 @@
import org.foray.ps.PsNumber;
import org.foray.ps.PsSystemDict4a;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -34,7 +34,7 @@
import org.foray.ps.PsOperator;
import org.foray.ps.PsSystemDict4a;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -32,7 +32,7 @@
import org.foray.ps.PsNumber;
import org.foray.ps.PsSystemDict4a;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
/**
* PsSystemDict implementation that provides no painting or other rendering, but that is suitable
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -40,7 +40,7 @@
import org.foray.render.PrintRenderer;
import org.foray.render.Renderer;
-import org.axsl.common.data.ByteSequence;
+import org.axsl.common.sequence.ByteSequence;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
import org.axsl.galley.BookmarkTree;
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-15 14:01:40 UTC (rev 11790)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-15 14:33:34 UTC (rev 11791)
@@ -42,8 +42,8 @@
import org.foray.render.PrintRenderer;
import org.axsl.common.Gradient;
-import org.axsl.common.data.ByteSequence;
-import org.axsl.common.data.IntSequence;
+import org.axsl.common.sequence.ByteSequence;
+import org.axsl.common.sequence.IntSequence;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-15 14:01:47
|
Revision: 11790
http://sourceforge.net/p/foray/code/11790
Author: victormote
Date: 2021-01-15 14:01:40 +0000 (Fri, 15 Jan 2021)
Log Message:
-----------
Conform to aXSL sequence changes.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/package-info.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-14 16:28:27 UTC (rev 11789)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -26,7 +26,6 @@
* $LastChangedBy$
*/
-
package org.foray.common.data;
import org.axsl.common.data.ByteSequence;
@@ -38,12 +37,19 @@
import java.nio.charset.Charset;
/**
- * Sub-interface of {@link ByteSequence} whose implementations provide additional services.
+ * Sub-interface of {@link ByteSequence} whose implementations provide additional read-only services.
* All methods in this interface must be read-only.
*/
public interface ByteSequencePlus extends ByteSequence {
/**
+ * Returns an array containing the {@link Byte#TYPE}s in this sequence in the same order as this sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of {@link Byte#TYPE}s.
+ */
+ byte[] toArray();
+
+ /**
* Convenience method that returns the value of the last element in this sequence.
* @return The value of the last byte in this sequence.
*/
@@ -91,14 +97,6 @@
CharSequence charSubSequence(int start, int end, String charsetName) throws UnsupportedEncodingException;
/**
- * Returns a copy of the internal array containing the {@code bytes}s in this sequence in the same order as this
- * sequence.
- * The length of the array will be the length of this sequence.
- * @return A new array consisting of exactly this sequence of bytes.
- */
- byte[] toArray();
-
- /**
* Indicates whether this sequence contains a given byte value.
* @param testByte The byte value to be tested.
* @return True if and only if this sequence contains at least one occurrence of {@code testByte}.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java 2021-01-14 16:28:27 UTC (rev 11789)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -30,7 +30,7 @@
package org.foray.common.data;
/**
- * Sub-interface of {@link CharSequence} whose implementations provide additional services.
+ * Sub-interface of {@link CharSequence} whose implementations provide additional read-only services.
* All methods in this interface must be read-only.
*/
public interface CharSequencePlus extends CharSequence {
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-14 16:28:27 UTC (rev 11789)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/IntSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -36,6 +36,13 @@
public interface IntSequencePlus extends IntSequence {
/**
+ * Returns an array containing the {@link Integer#TYPE}s in this sequence in the same order as this sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of {@link Integer#TYPE}s.
+ */
+ int[] toArray();
+
+ /**
* Returns the index within this sequence of the first occurrence of {@code anInt}.
* If an int with value {@code anInt} occurs in the sequence represented by this object, then the index of the
* first such occurrence is returned.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-14 16:28:27 UTC (rev 11789)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArray.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -28,6 +28,8 @@
package org.foray.common.data;
+import org.foray.common.sequence.LongSequencePlus;
+
import org.axsl.common.data.LongSequence;
import java.util.Arrays;
@@ -37,7 +39,7 @@
* an array of chars.
* Instances of this class are immutable.
*/
-public class LongArray implements LongSequence {
+public class LongArray implements LongSequencePlus {
/* *****************************************************************************************************************
* DEVELOPER NOTE: As methods are added to this class, please make them analogous to those in {@link String}.
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-14 16:28:27 UTC (rev 11789)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/LongArrayBuilder.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -28,6 +28,8 @@
package org.foray.common.data;
+import org.foray.common.sequence.LongSequencePlus;
+
import org.axsl.common.data.LongSequence;
import java.util.Arrays;
@@ -39,7 +41,7 @@
* <p>This class can also operate as a stack of primitive longs.
* The {@link #push(long)}, {@link #pop()}, and {@link #peek()} methods exist to support that use case.</p>
*/
-public class LongArrayBuilder implements LongSequence {
+public class LongArrayBuilder implements LongSequencePlus {
/** The initial size of the array of no initial size is specified. */
private static final int DEFAULT_INITIAL_SIZE = 10;
Added: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/BooleanSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common.sequence;
+
+import org.axsl.common.data.BooleanSequence;
+
+/**
+ * Sub-interface of {@link BooleanSequence} whose implementations provide additional read-only services.
+ * All methods in this interface must be read-only.
+ */
+public interface BooleanSequencePlus extends BooleanSequence {
+
+ /**
+ * Returns an array containing the {@link Boolean#TYPE}s in this sequence in the same order as this sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of {@link Boolean#TYPE}s.
+ */
+ boolean[] toArray();
+
+}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/LongSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common.sequence;
+
+import org.axsl.common.data.LongSequence;
+
+/**
+ * Sub-interface of {@link LongSequence} whose implementations provide additional read-only services.
+ * All methods in this interface must be read-only.
+ */
+public interface LongSequencePlus extends LongSequence {
+
+ /**
+ * Returns an array containing the {@link Long#TYPE}s in this sequence in the same order as this sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of {@link Long#TYPE}s.
+ */
+ long[] toArray();
+
+}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ShortSequencePlus.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common.sequence;
+
+import org.axsl.common.data.ShortSequence;
+
+/**
+ * Sub-interface of {@link ShortSequence} whose implementations provide additional read-only services.
+ * All methods in this interface must be read-only.
+ */
+public interface ShortSequencePlus extends ShortSequence {
+
+ /**
+ * Returns an array containing the {@link Short#TYPE}s in this sequence in the same order as this sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of {@link Boolean#TYPE}s.
+ */
+ short[] toArray();
+
+}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/package-info.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/package-info.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/package-info.java 2021-01-15 14:01:40 UTC (rev 11790)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision: 10899 $
+ * $LastChangedDate: 2010-01-30 10:37:15 -0700 (Sat, 30 Jan 2010) $
+ * $LastChangedBy$
+ */
+
+/**
+ * Wrappers of primitive arrays, intended to make array handling more safe and more flexible, and to make code using
+ * them more fluent.
+ */
+package org.foray.common.sequence;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 16:28:30
|
Revision: 11789
http://sourceforge.net/p/foray/code/11789
Author: victormote
Date: 2021-01-14 16:28:27 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Rough-in some new array wrapper code that handles mutable arrays, in preparation for changes in font API.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-14 13:33:03 UTC (rev 11788)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArrayBuilder.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -49,7 +49,7 @@
* {@link CharSequence}, this class is analogous to {@link StringBuilder}.
* Similar to {@link StringBuilder}, it will resize itself as necessary.
*/
-public class ByteArrayBuilder extends AbstractByteSequence implements ByteSequence, Serializable {
+public class ByteArrayBuilder extends AbstractByteSequence implements ByteSequenceMutable, Serializable {
/**
* The maximum size of array to allocate (unless necessary).
@@ -393,4 +393,14 @@
setLength(0);
}
+ @Override
+ public void sort() {
+ Arrays.sort(this.backingArray);
+ }
+
+ @Override
+ public int binarySearch(final byte value) {
+ return Arrays.binarySearch(this.backingArray, 0, length(), value);
+ }
+
}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceMutable.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision: 11416 $
+ * $LastChangedDate: 2019-02-14 08:11:46 -0700 (Thu, 14 Feb 2019) $
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.common.data;
+
+/**
+ * A mutable byte sequence.
+ */
+public interface ByteSequenceMutable extends ByteSequencePlus {
+
+ /**
+ * Sorts the specified array into ascending numerical order.
+ * @see java.util.Arrays#sort(byte[])
+ */
+ void sort();
+
+ /**
+ * <p>Pass-through call {@link java.util.Arrays#binarySearch(byte[], byte)}.
+ * Performs a binary search to find a given value in this sequence.
+ * This sequence must be first sorted for this to be effective.</p>
+ * <p>Development Note: Since this is a read-only method, it is tempting to think that this method should be
+ * included in {@link ByteSequencePlus}.
+ * However, binary search requires that the content first be sorted, which cannot be guaranteed with immutable
+ * objects.</p>
+ * @param value The value searched for.
+ * @return Same as for {@link java.util.Arrays#binarySearch(byte[], byte)}.
+ * @see java.util.Arrays#binarySearch(byte[], byte)
+ */
+ int binarySearch(byte value);
+
+}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-14 13:33:03 UTC (rev 11788)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequencePlus.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -39,6 +39,7 @@
/**
* Sub-interface of {@link ByteSequence} whose implementations provide additional services.
+ * All methods in this interface must be read-only.
*/
public interface ByteSequencePlus extends ByteSequence {
Added: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharArrayBuilder.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common.data;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * A mutable array of chars that resizes itself as necessary.
+ * This is a subsitute for {@link StringBuilder}.
+ */
+public class CharArrayBuilder implements CharSequenceMutable, Serializable {
+
+ /**
+ * The maximum size of array to allocate (unless necessary).
+ * Some VMs reserve some header words in an array.
+ * Attempts to allocate larger arrays may result in OutOfMemoryError: Requested array size exceeds VM limit.
+ * This value is based on {@link java.lang.AbstractStringBuilder}.MAX_ARRAY_SIZE.
+ * @see java.lang.AbstractStringBuilder
+ */
+ public static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 3764720272508615707L;
+
+ /** Default Capacity increment size. */
+ private static final int DEFAULT_BLOCK_SIZE = 2048;
+
+ /** Capacity increment size. */
+ private int blockSize = CharArrayBuilder.DEFAULT_BLOCK_SIZE;
+
+ /** The encapsulated array. */
+ private char[] backingArray;
+
+ /** Index to to the next free item in {@link #backingArray}. */
+ private int nextIndex;
+
+ /**
+ * No-argument constructor.
+ */
+ public CharArrayBuilder() {
+ this(CharArrayBuilder.DEFAULT_BLOCK_SIZE);
+ }
+
+ /**
+ * Constructor.
+ * @param capacity The initial capacity, in chars, of the backing array.
+ */
+ public CharArrayBuilder(final int capacity) {
+ if (capacity > 0) {
+ this.blockSize = capacity;
+ } else {
+ this.blockSize = CharArrayBuilder.DEFAULT_BLOCK_SIZE;
+ }
+ this.backingArray = new char[this.blockSize];
+ this.nextIndex = 0;
+ }
+
+ /**
+ * Returns the number of elements used in the backing array.
+ * @return The number of elements used in the backing array.
+ */
+ public int length() {
+ return this.nextIndex;
+ }
+
+ /**
+ * Returns the current capacity of the backing array, i.e. the number of items that the array can hold without
+ * needing to increase its size.
+ * @return The currect capacity of the backing array.
+ */
+ public int capacity() {
+ return this.backingArray.length;
+ }
+
+ /**
+ * Allocates or uses a specified number of elements (chars).
+ * If needed, this method automatically increases the vector's capacity.
+ * @param size The number of elements (chars) to be allocated.
+ * @return The index to the beginning of the allocated elements (chars).
+ */
+ public int alloc(final int size) {
+ final int index = this.nextIndex;
+ if (this.nextIndex + size >= this.backingArray.length) {
+ final char[] newArray = new char[this.backingArray.length
+ + this.blockSize];
+ System.arraycopy(this.backingArray, 0, newArray, 0,
+ this.backingArray.length);
+ this.backingArray = newArray;
+ }
+ this.nextIndex += size;
+ return index;
+ }
+
+ /**
+ * Ensures that the capacity is at least equal to the specified minimum.
+ * If the current capacity is less than the argument, then a new internal
+ * array is allocated with greater capacity. The new capacity is the
+ * larger of:
+ * <ul>
+ * <li>The {@code minimumCapacity} argument.
+ * <li>Twice the old capacity, plus {@code 2}.
+ * </ul>
+ * If the {@code minimumCapacity} argument is nonpositive, this
+ * method takes no action and simply returns.
+ * Note that subsequent operations on this object can reduce the
+ * actual capacity below that requested here.
+ *
+ * @param minimumCapacity the minimum desired capacity.
+ * @see StringBuilder#ensureCapacity(int)
+ */
+ public void ensureCapacity(final int minimumCapacity) {
+ if (minimumCapacity > 0) {
+ ensureCapacityInternal(minimumCapacity);
+ }
+ }
+
+ /**
+ * For positive values of {@code minimumCapacity}, this method
+ * behaves like {@code ensureCapacity}, however it is never
+ * synchronized.
+ * If {@code minimumCapacity} is non positive due to numeric
+ * overflow, this method throws {@code OutOfMemoryError}.
+ * @param minimumCapacity the minimum desired capacity.
+ * @see {@link StringBuilder#ensureCapacity(int)}
+ */
+ private void ensureCapacityInternal(final int minimumCapacity) {
+ // overflow-conscious code
+ if (minimumCapacity - this.backingArray.length > 0) {
+ backingArray = Arrays.copyOf(backingArray,
+ newCapacity(minimumCapacity));
+ }
+ }
+
+ /**
+ * Returns a capacity at least as large as the given minimum capacity.
+ * Returns the current capacity increased by the same amount + 2 if
+ * that suffices.
+ * Will not return a capacity greater than {@code MAX_ARRAY_SIZE}
+ * unless the given minimum capacity is greater than that.
+ *
+ * @param minCapacity the desired minimum capacity
+ * @return The new capacity.
+ * @throws OutOfMemoryError if minCapacity is less than zero or
+ * greater than Integer.MAX_VALUE
+ */
+ private int newCapacity(final int minCapacity) {
+ // overflow-conscious code
+ int newCapacity = (this.backingArray.length << 1) + 2;
+ if (newCapacity - minCapacity < 0) {
+ newCapacity = minCapacity;
+ }
+ return (newCapacity <= 0 || MAX_ARRAY_SIZE - newCapacity < 0)
+ ? hugeCapacity(minCapacity)
+ : newCapacity;
+ }
+
+ private int hugeCapacity(final int minCapacity) {
+ if (Integer.MAX_VALUE - minCapacity < 0) { // overflow
+ throw new OutOfMemoryError();
+ }
+ return (minCapacity > MAX_ARRAY_SIZE)
+ ? minCapacity : MAX_ARRAY_SIZE;
+ }
+
+ /**
+ * Sets the capacity of this vector equal to its size, to that there is no
+ * unused capacity.
+ */
+ public void trimToSize() {
+ if (this.nextIndex < this.backingArray.length) {
+ final char[] aux = new char[this.nextIndex];
+ System.arraycopy(this.backingArray, 0, aux, 0, this.nextIndex);
+ this.backingArray = aux;
+ }
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+
+ /**
+ * Resets the length of this sequence to a specified length.
+ * The <em>capacity</em> of the sequence remains unchanged unless it needs to increase to accommodate a bigger size.
+ * <p>If {@code newLength} is greater than the current length, the existing elements in the sequence are unchanged,
+ * and the chars that have effectively been appended to the sequence are filled with zero.</p>
+ * @param newLength The new length of this sequence. Must be greater than or equal to {@code 0}.
+ * @throws IndexOutOfBoundsException If {@code newLength} is negative.
+ */
+ public void setLength(final int newLength) {
+ if (newLength < 0) {
+ throw new StringIndexOutOfBoundsException(newLength);
+ }
+ ensureCapacityInternal(newLength);
+
+ while (this.nextIndex < newLength) {
+ this.backingArray[this.nextIndex] = 0;
+ this.nextIndex ++;
+ }
+ this.nextIndex = newLength;
+ }
+
+ /**
+ * Resets the length of this sequence to a 0, allowing it to be reused.
+ * The <em>capacity</em> of the sequence remains unchanged.
+ */
+ public void clear() {
+ setLength(0);
+ }
+
+ @Override
+ public void sort() {
+ Arrays.sort(this.backingArray);
+ }
+
+ @Override
+ public int binarySearch(final char value) {
+ return Arrays.binarySearch(this.backingArray, 0, length(), value);
+ }
+
+ @Override
+ public char lastChar() {
+ return this.charAt(this.nextIndex - 1);
+ }
+
+ @Override
+ public char[] toArray() {
+ return Arrays.copyOf(this.backingArray, this.nextIndex);
+ }
+
+ @Override
+ public boolean contains(final char testChar) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public char charAt(final int index) {
+ if ((index < 0) || (index >= this.nextIndex)) {
+ throw new IndexOutOfBoundsException("Index out of bounds: " + index);
+ }
+ return this.backingArray[index];
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ return new String(this.backingArray, start, end - start);
+ }
+
+ @Override
+ public void setCharAt(final int index, final char ch) {
+ if ((index < 0) || (index >= this.nextIndex)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ this.backingArray[index] = ch;
+ }
+
+}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequenceMutable.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2021 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision: 11416 $
+ * $LastChangedDate: 2019-02-14 08:11:46 -0700 (Thu, 14 Feb 2019) $
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.common.data;
+
+/**
+ * A mutable char sequence.
+ * Implementations of this class will have some similarities with {@link StringBuilder}.
+ * However, {@link StringBuilder} cannot be made to conform to this interface, and, as it is a final class, it cannot
+ * be subclassed to conform to this interface either.
+ * That said, this interface should attempt to conform to the naming conventions used in that class.
+ */
+public interface CharSequenceMutable extends CharSequencePlus {
+
+ /**
+ * The character at the specified index is set to {@code ch}.
+ * This sequence is altered to represent a new character sequence that is identical to the old character sequence,
+ * except that it contains the character {@code ch} at position {@code index}.
+ * <p>
+ *
+ *
+ * @param index The index of the character to modify. This must be greater than or equal to {@code 0}, and less than
+ * the length of this sequence.
+ * @param ch The new character.
+ * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}.
+ * @see java.lang.AbstractStringBuilder#setCharAt(int, char)
+ */
+ void setCharAt(int index, char ch);
+
+ /**
+ * Sorts the specified array into ascending numerical order.
+ * @see java.util.Arrays#sort(byte[])
+ */
+ void sort();
+
+ /**
+ * <p>Pass-through call to {@link java.util.Arrays#binarySearch(char[], char)}.
+ * Performs a binary search to find a given value in this sequence.
+ * This sequence must be first sorted for this to be effective.</p>
+ * <p>Development Note: Since this is a read-only method, it is tempting to think that this method should be
+ * included in {@link CharSequencePlus}.
+ * However, binary search requires that the content first be sorted, which cannot be guaranteed with immutable
+ * objects.</p>
+ * @param value The value searched for.
+ * @return Same as for {@link java.util.Arrays#binarySearch(char[], char)}.
+ * @see java.util.Arrays#binarySearch(char[], char)
+ */
+ int binarySearch(char value);
+
+}
Added: trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/CharSequencePlus.java 2021-01-14 16:28:27 UTC (rev 11789)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2020 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+
+package org.foray.common.data;
+
+/**
+ * Sub-interface of {@link CharSequence} whose implementations provide additional services.
+ * All methods in this interface must be read-only.
+ */
+public interface CharSequencePlus extends CharSequence {
+
+ /**
+ * Convenience method that returns the value of the last element in this sequence.
+ * @return The value of the last byte in this sequence.
+ */
+ char lastChar();
+
+ /**
+ * Returns a copy of the internal array containing the {@code bytes}s in this sequence in the same order as this
+ * sequence.
+ * The length of the array will be the length of this sequence.
+ * @return A new array consisting of exactly this sequence of bytes.
+ */
+ char[] toArray();
+
+ /**
+ * Indicates whether this sequence contains a given char value.
+ * @param testChar The char value to be tested.
+ * @return True if and only if this sequence contains at least one occurrence of {@code testChar}.
+ */
+ boolean contains(char testChar);
+
+ /**
+ * Indicates whether this instance is mutable, i.e. whether its content can be changed after it has been created.
+ * @return True if and only if this instance <em>can </em>be changed after it has been created.
+ */
+ boolean isMutable();
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 13:33:05
|
Revision: 11788
http://sourceforge.net/p/foray/code/11788
Author: victormote
Date: 2021-01-14 13:33:03 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Conform to aXSL changes converting char[] to CharSequence.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-14 12:32:33 UTC (rev 11787)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-14 13:33:03 UTC (rev 11788)
@@ -735,7 +735,7 @@
* For fonts that have been subsetted, only the characters that are
* included in the subset are returned.
*/
- public char[] getCharsUsed() {
+ public CharSequence getCharsUsed() {
if (! getFOrayFont().isEmbeddable()) {
return null;
}
@@ -753,7 +753,7 @@
final int arrayItem = encoding.decodeCharacter((char) i);
charArray[i] = (char) arrayItem;
}
- return charArray;
+ return new String(charArray);
}
/**
@@ -761,7 +761,7 @@
* returns the chars used for the font subset.
* @return The chars actually used by the document.
*/
- private char[] getSubsetCharsUsed() {
+ private CharSequence getSubsetCharsUsed() {
final Subset subset = getSubset();
final Encoding encoding = getEncoding();
final char[] charArray = new char[subset.numGlyphsUsed()];
@@ -771,7 +771,7 @@
(char) originalGlyphIndex);
charArray[i] = (char) codePoint;
}
- return charArray;
+ return new String(charArray);
}
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java 2021-01-14 12:32:33 UTC (rev 11787)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java 2021-01-14 13:33:03 UTC (rev 11788)
@@ -121,7 +121,7 @@
* subset.
*/
public String getToUnicodeBf() {
- final char[] charArray = this.fsFont.getCharsUsed();
+ final CharSequence charArray = this.fsFont.getCharsUsed();
final StringBuilder buffer = new StringBuilder();
writeBFCharEntries(buffer, charArray);
writeBFRangeEntries(buffer, charArray);
@@ -133,11 +133,10 @@
* @param p The buffer to which the entries should be written.
* @param charArray The chars which should be written.
*/
- protected void writeBFCharEntries(final StringBuilder p,
- final char[] charArray) {
+ protected void writeBFCharEntries(final StringBuilder p, final CharSequence charArray) {
int completedEntries = 0;
int totalEntries = 0;
- for (int i = 0; i < charArray.length; i++) {
+ for (int i = 0; i < charArray.length(); i++) {
if (! partOfRange(charArray, i)) {
totalEntries ++;
}
@@ -151,7 +150,7 @@
PdfToUnicodeCmap.MAX_BF_ENTRIES_PER_SECTION);
int remainingEntriesThisSection = entriesThisSection;
p.append(entriesThisSection + " beginbfchar" + this.eol);
- for (int i = 0; i < charArray.length; i++) {
+ for (int i = 0; i < charArray.length(); i++) {
if (partOfRange(charArray, i)) {
continue;
}
@@ -158,7 +157,7 @@
p.append("<" + padHexString(Integer.toHexString(i),
PdfToUnicodeCmap.HEX_STRING_CHAR_SIZE)
+ "> ");
- p.append("<" + padHexString(Integer.toHexString(charArray[i]),
+ p.append("<" + padHexString(Integer.toHexString(charArray.charAt(i)),
PdfToUnicodeCmap.HEX_STRING_CHAR_SIZE)
+ ">" + this.eol);
/* Compute the statistics. */
@@ -183,11 +182,10 @@
* @param p The buffer to which the entries should be written.
* @param charArray The chars which should be written.
*/
- protected void writeBFRangeEntries(final StringBuilder p,
- final char[] charArray) {
+ protected void writeBFRangeEntries(final StringBuilder p, final CharSequence charArray) {
int completedEntries = 0;
int totalEntries = 0;
- for (int i = 0; i < charArray.length; i++) {
+ for (int i = 0; i < charArray.length(); i++) {
if (startOfRange(charArray, i)) {
totalEntries ++;
}
@@ -200,7 +198,7 @@
PdfToUnicodeCmap.MAX_BF_ENTRIES_PER_SECTION);
int remainingEntriesThisSection = entriesThisSection;
p.append(entriesThisSection + " beginbfrange" + this.eol);
- for (int i = 0; i < charArray.length; i++) {
+ for (int i = 0; i < charArray.length(); i++) {
if (! startOfRange(charArray, i)) {
continue;
}
@@ -213,7 +211,7 @@
charArray, i)), PdfToUnicodeCmap.HEX_STRING_CHAR_SIZE)
+ "> ");
p.append("<"
- + padHexString(Integer.toHexString(charArray[i]),
+ + padHexString(Integer.toHexString(charArray.charAt(i)),
PdfToUnicodeCmap.HEX_STRING_CHAR_SIZE)
+ ">" + this.eol);
/* Compute the statistics. */
@@ -239,9 +237,9 @@
* the range.
* @return The index to the element that is the end of the range.
*/
- private int endOfRange(final char[] charArray, final int startOfRange) {
+ private int endOfRange(final CharSequence charArray, final int startOfRange) {
int endOfRange = -1;
- for (int i = startOfRange; i < charArray.length - 1 && endOfRange < 0;
+ for (int i = startOfRange; i < charArray.length() - 1 && endOfRange < 0;
i++) {
if (! sameRangeEntryAsNext(charArray, i)) {
endOfRange = i;
@@ -257,14 +255,14 @@
* @param arrayIndex The index to the array element to be tested.
* @return True if this array element should be included in a range.
*/
- private boolean partOfRange(final char[] charArray, final int arrayIndex) {
- if (charArray.length < 2) {
+ private boolean partOfRange(final CharSequence charArray, final int arrayIndex) {
+ if (charArray.length() < 2) {
return false;
}
if (arrayIndex == 0) {
return sameRangeEntryAsNext(charArray, 0);
}
- if (arrayIndex == charArray.length - 1) {
+ if (arrayIndex == charArray.length() - 1) {
return sameRangeEntryAsNext(charArray, arrayIndex - 1);
}
if (sameRangeEntryAsNext(charArray, arrayIndex - 1)) {
@@ -285,9 +283,8 @@
* this one, and 2) the first byte of the character in the first position
* is equal to the first byte of the character in the second position.
*/
- private boolean sameRangeEntryAsNext(final char[] charArray,
- final int firstItem) {
- if (charArray[firstItem] + 1 != charArray[firstItem + 1]) {
+ private boolean sameRangeEntryAsNext(final CharSequence charArray, final int firstItem) {
+ if (charArray.charAt(firstItem) + 1 != charArray.charAt(firstItem + 1)) {
return false;
}
if (firstItem / WellKnownConstants.MAX_8_BIT_UNSIGNED_VALUES
@@ -304,8 +301,7 @@
* @param arrayIndex The index to the array element to be tested.
* @return True if this array element is the beginning of a range.
*/
- private boolean startOfRange(final char[] charArray,
- final int arrayIndex) {
+ private boolean startOfRange(final CharSequence charArray, final int arrayIndex) {
// Can't be the start of a range if not part of a range.
if (! partOfRange(charArray, arrayIndex)) {
return false;
@@ -315,7 +311,7 @@
return true;
}
// If last element in the array, cannot be start of a range
- if (arrayIndex == charArray.length - 1) {
+ if (arrayIndex == charArray.length() - 1) {
return false;
}
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 12:32:35
|
Revision: 11787
http://sourceforge.net/p/foray/code/11787
Author: victormote
Date: 2021-01-14 12:32:33 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Fix minor javadoc problems.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-14 11:35:36 UTC (rev 11786)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-14 12:32:33 UTC (rev 11787)
@@ -140,9 +140,9 @@
* Creates a ByteArray instance from a character sequence in which each character is expected to be the ASCII
* representation of a hexadecimal digit, i.e. in the range 0-9, A-F, or a-f.
* @param charSequence The char sequence to be converted into a byte array. This must have an even length.
- * @return If {@link charSequence} is null, returns null.
+ * @return If {@code charSequence} is null, returns null.
* In all other cases, returns a new byte array.
- * @throws IllegalArgumentException If {@link charSequence} does not contain an even number of characters.
+ * @throws IllegalArgumentException If {@code charSequence} does not contain an even number of characters.
*/
public static ByteArray fromHexCharSequence(final CharSequence charSequence) {
if (charSequence == null) {
@@ -168,9 +168,9 @@
* Creates a ByteArray instance from a byte sequence in which each byte is expected to be the ASCII
* representation of a hexadecimal digit, i.e. in the range 0-9, A-F, or a-f.
* @param byteSequence The byte sequence to be converted into a byte array. This must have an even length.
- * @return If {@link byteSequence} is null, returns null.
+ * @return If {@code byteSequence} is null, returns null.
* In all other cases, returns a new byte array.
- * @throws IllegalArgumentException If {@link byteSequence} does not contain an even number of characters.
+ * @throws IllegalArgumentException If {@code byteSequence} does not contain an even number of characters.
*/
public static ByteArray fromHexByteSequence(final ByteSequence byteSequence) {
if (byteSequence == null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 11:35:38
|
Revision: 11786
http://sourceforge.net/p/foray/code/11786
Author: victormote
Date: 2021-01-14 11:35:36 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Conform to aXSL changes converting byte[] to ByteSequence.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-14 11:06:36 UTC (rev 11785)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-14 11:35:36 UTC (rev 11786)
@@ -107,12 +107,47 @@
}
/**
+ * Converts an existing byte sequence to a byte array, creating the byte array only if necessary.
+ * @param sequence The sequence to be converted.
+ * @return If {@code sequence} is null, returns null.
+ * If {@code sequence} is already a {@link ByteArray} instance, returns that instance.
+ * In all other cases, returns a newly-created {@link ByteArray} instance containing the bytes in {@code sequence}.
+ */
+ public static ByteArray fromByteSequence(final ByteSequence sequence) {
+ if (sequence == null) {
+ return null;
+ }
+ if (sequence instanceof ByteArray) {
+ return (ByteArray) sequence;
+ }
+ return new ByteArray(sequence);
+ }
+
+ /**
+ * Converts a char sequence to a byte array, check first to make sure it is not null.
+ * @param sequence The sequence to be converted.
+ * @return If {@code sequence} is null, returns null.
+ * In all other cases, returns a newly-created {@link ByteArray} instance containing the bytes in {@code sequence}.
+ */
+ public static ByteArray fromCharSequence(final CharSequence sequence) {
+ if (sequence == null) {
+ return null;
+ }
+ return new ByteArray(sequence);
+ }
+
+ /**
* Creates a ByteArray instance from a character sequence in which each character is expected to be the ASCII
* representation of a hexadecimal digit, i.e. in the range 0-9, A-F, or a-f.
* @param charSequence The char sequence to be converted into a byte array. This must have an even length.
- * @return The new byte array.
+ * @return If {@link charSequence} is null, returns null.
+ * In all other cases, returns a new byte array.
+ * @throws IllegalArgumentException If {@link charSequence} does not contain an even number of characters.
*/
public static ByteArray fromHexCharSequence(final CharSequence charSequence) {
+ if (charSequence == null) {
+ return null;
+ }
if (NumberUtils.isOdd(charSequence.length())) {
throw new IllegalArgumentException("The CharSequence must be of even length.");
}
@@ -133,9 +168,14 @@
* Creates a ByteArray instance from a byte sequence in which each byte is expected to be the ASCII
* representation of a hexadecimal digit, i.e. in the range 0-9, A-F, or a-f.
* @param byteSequence The byte sequence to be converted into a byte array. This must have an even length.
- * @return The new byte array.
+ * @return If {@link byteSequence} is null, returns null.
+ * In all other cases, returns a new byte array.
+ * @throws IllegalArgumentException If {@link byteSequence} does not contain an even number of characters.
*/
public static ByteArray fromHexByteSequence(final ByteSequence byteSequence) {
+ if (byteSequence == null) {
+ return null;
+ }
if (NumberUtils.isOdd(byteSequence.length())) {
throw new IllegalArgumentException("The ByteSequence must be of even length.");
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-14 11:06:36 UTC (rev 11785)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-01-14 11:35:36 UTC (rev 11786)
@@ -29,6 +29,7 @@
package org.foray.font;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
import org.foray.common.data.IntArrayBuilder;
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.UnicodeCharUtils;
@@ -37,6 +38,7 @@
import org.foray.font.format.ttf.TtfTableGsub;
import org.foray.font.format.type1.Type1Font;
+import org.axsl.common.data.ByteSequence;
import org.axsl.common.data.IntSequence;
import org.axsl.common.i18n.Orthography;
import org.axsl.font.Font;
@@ -539,7 +541,7 @@
}
@Override
- public byte[] getContent() {
+ public ByteSequence getContent() {
/*
* Returns the Collection of byte arrays to be placed in the embedded
* font stream in the PDF file, as documented in the PDF Reference,
@@ -565,11 +567,11 @@
this.getLogger().error("Error reading contents of "
+ fsf.getPostscriptName() + ": " + e.getMessage());
}
- return embeddableFont;
+ return new ByteArray(embeddableFont);
}
@Override
- public byte[] getContentPostScriptHex() {
+ public ByteSequence getContentPostScriptHex() {
final Font font = getFont();
if (! (font instanceof FsType1Font)) {
return null;
@@ -582,7 +584,7 @@
/* TODO: Handle the exception at a lower level and remove this catch. */
return null;
}
- return pfb.getByteArray();
+ return new ByteArray(pfb.getByteArray());
}
@Override
@@ -795,11 +797,11 @@
/* TODO: This needs to handle subsets. */
final Type1Font type1Font = getType1Font();
if (type1Font == null) {
- final byte[] content = getContent();
+ final ByteSequence content = getContent();
if (content == null) {
return 0;
}
- return content.length;
+ return content.length();
} else {
return type1Font.getLength1();
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-14 11:06:36 UTC (rev 11785)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-14 11:35:36 UTC (rev 11786)
@@ -28,6 +28,7 @@
package org.foray.pdf.object;
+import org.axsl.common.data.ByteSequence;
import org.axsl.font.FontUse;
import org.axsl.pdf.PdfException;
@@ -54,7 +55,7 @@
@Override
protected void finalizeStreamContent(final PdfDocument4a doc) throws PdfException {
- final byte[] fontFileStream = this.font.getContent();
+ final ByteSequence fontFileStream = this.font.getContent();
/* TODO: The addition of the filters below was prohibited by the parent class, PdfStream, because content
* had already been written into the stream without them. There is perhaps some sequencing problem that has
* resulted from the one-step serialization process recently (Dec 2020) implemented. */
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-14 11:06:36 UTC (rev 11785)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-14 11:35:36 UTC (rev 11786)
@@ -37,6 +37,7 @@
import org.foray.common.CharacterOutputStream;
import org.foray.common.Mime;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
import org.foray.common.primitive.StringUtils;
import org.foray.render.PrintRenderer;
@@ -357,7 +358,7 @@
if (! font.isEmbeddable()) {
continue;
}
- final String fontContents = new String(fontUse.getContentPostScriptHex());
+ final String fontContents = ByteArray.fromByteSequence(fontUse.getContentPostScriptHex()).toString();
write(fontContents);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 11:06:39
|
Revision: 11785
http://sourceforge.net/p/foray/code/11785
Author: victormote
Date: 2021-01-14 11:06:36 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Conform to aXSL changes converting byte[] to ByteSequence.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -34,7 +34,9 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -128,7 +130,7 @@
* to read the resultant PDF, so we will hardcode this...
*/
setBitDepth(BIT_DEPTH_GRAYSCALE);
- setContent(normalizedBytes);
+ setContent(new ByteArray(normalizedBytes));
}
/**
@@ -433,7 +435,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* TODO: Add support for this feature. */
throw new GraphicException("Unsupported feature getRawSamples() in "
+ this.getClass().getName() + "for: "
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -30,8 +30,10 @@
import org.foray.common.ByteSequenceSearcher;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
import org.foray.common.ps.BoundingBox4a;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.PsBoundingBox;
@@ -111,7 +113,7 @@
private int tiffLength = 0;
/** The entire contents of the file. */
- private byte[] fileContents;
+ private ByteArray fileContents;
/** Image width (in pixel). */
private int pixelWidth = 0;
@@ -163,7 +165,7 @@
getUrl().toString() + " : " + ex.getClass() +
" - " + ex.getMessage());
}
- this.fileContents = baos.toByteArray();
+ this.fileContents = new ByteArray(baos.toByteArray());
}
@Override
@@ -216,7 +218,7 @@
}
@Override
- public byte[] getContent() throws GraphicException {
+ public ByteSequence getContent() throws GraphicException {
this.loadImageWrapper();
if (this.isAscii) {
return this.fileContents;
@@ -224,7 +226,7 @@
final byte[] epsFile = new byte[this.psLength];
System.arraycopy(this.fileContents, this.psStart, epsFile, 0,
this.psLength);
- return epsFile;
+ return new ByteArray(epsFile);
}
/**
@@ -323,7 +325,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* EPS is not typically a raster format. */
return null;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -29,7 +29,9 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -150,7 +152,7 @@
contentBytes[contentIndex] = b;
}
}
- setContent(contentBytes);
+ setContent(new ByteArray(contentBytes));
}
/**
@@ -250,7 +252,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* TODO: Add support for this feature. */
throw new GraphicException("Unsupported feature getRawSamples() in "
+ this.getClass().getName() + "for: "
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -29,9 +29,11 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
import org.foray.graphic.factory.GraphicFactory;
import org.foray.graphic.output.GraphicOutputFactory;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutput;
@@ -84,7 +86,7 @@
private int bitDepth = 0;
/** Image data (uncompressed). */
- private byte[] content = null;
+ private ByteArray content = null;
/**
* Set to true if the basics of the file have been parsed, that is, the
@@ -130,7 +132,7 @@
}
@Override
- public byte[] getContent() throws GraphicException {
+ public ByteSequence getContent() throws GraphicException {
this.loadImageWrapper();
return this.content;
}
@@ -141,7 +143,7 @@
if (this.content == null) {
return 0;
}
- return this.content.length;
+ return this.content.length();
}
@Override
@@ -361,7 +363,7 @@
* Sets the content for this graphic.
* @param content The new content.
*/
- public void setContent(final byte[] content) {
+ public void setContent(final ByteArray content) {
this.content = content;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/JpegGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -36,7 +36,9 @@
import org.foray.common.ColorSpaceCmyk;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -138,7 +140,7 @@
private boolean foundICCProfile = false;
/** Raw image samples (assumed to be compressed using DCT/JPEG). */
- private byte[] rawContent = null;
+ private ByteArray rawContent = null;
/** Some image files, such as Photoshop-generated cmyk jpegs are
* inverted. */
@@ -225,7 +227,7 @@
== ColorSpace.TYPE_CMYK) {
this.inverted = true;
}
- this.rawContent = contentBytes;
+ this.rawContent = new ByteArray(contentBytes);
}
/**
@@ -530,13 +532,13 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
this.loadImageWrapper();
return this.rawContent;
}
@Override
- public byte[] getContent() throws GraphicException {
+ public ByteSequence getContent() throws GraphicException {
/* TODO: Add support for this feature. */
throw new GraphicException("Unsupported feature getContent() in "
+ this.getClass().getName() + "for: "
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/MathGraphic4a.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -30,6 +30,7 @@
import org.foray.common.Mime;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -130,7 +131,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* MathML is not a raster format. */
return null;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PdfGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,9 @@
package org.foray.graphic;
+import org.foray.common.data.ByteArray;
+
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -86,7 +89,7 @@
getUrl().toString() + " : " + ex.getClass() +
" - " + ex.getMessage());
}
- setContent(baos.toByteArray());
+ setContent(new ByteArray(baos.toByteArray()));
}
@Override
@@ -109,7 +112,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* PDF is not a raster format. */
return null;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -29,7 +29,9 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -242,7 +244,7 @@
}
this.seekableInput = null;
this.cr = null;
- this.setContent(decodedBytes);
+ this.setContent(new ByteArray(decodedBytes));
}
/**
@@ -302,7 +304,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* TODO: Add support for this feature. */
throw new GraphicException("Unsupported feature getRawSamples() in "
+ this.getClass().getName() + "for: "
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -31,6 +31,7 @@
import org.foray.common.Mime;
import org.foray.graphic.batik.BatikUaAwt;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -192,7 +193,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
/* SVG is not a raster format. */
return null;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TempImage.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -29,7 +29,9 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.GraphicLink;
@@ -58,7 +60,7 @@
private ColorSpace colorSpace;
/** The bitmap data for the image. */
- private byte[] bitmaps;
+ private ByteArray bitmaps;
/** The transparent color. */
private Color transparent = Color.white;
@@ -79,7 +81,7 @@
this.height = height;
this.width = width;
this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
- this.bitmaps = result;
+ this.bitmaps = new ByteArray(result);
}
@Override
@@ -124,7 +126,7 @@
}
@Override
- public byte[] getContent() throws GraphicException {
+ public ByteSequence getContent() throws GraphicException {
return this.bitmaps;
}
@@ -168,7 +170,7 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
return null;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -34,7 +34,9 @@
package org.foray.graphic;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -160,7 +162,7 @@
private int fillOrder = 1;
/** Raw image samples (possibly compressed). */
- private byte[] rawContent = null;
+ private ByteArray rawContent = null;
/** The InputStream wrapped into a SeekableStream for decoding. */
private SeekableStream seekableInput = null;
@@ -308,7 +310,7 @@
& WellKnownConstants.MAX_8_BIT_UNSIGNED_INT];
}
}
- this.rawContent = readBuf;
+ this.rawContent = new ByteArray(readBuf);
return;
} catch (final IOException ioe) {
@@ -333,13 +335,13 @@
}
@Override
- public byte[] getRawSamples() throws GraphicException {
+ public ByteSequence getRawSamples() throws GraphicException {
this.loadImageWrapper();
return this.rawContent;
}
@Override
- public byte[] getContent() throws GraphicException {
+ public ByteSequence getContent() throws GraphicException {
/* TODO: Add support for this feature. */
throw new GraphicException("Unsupported feature getContent() in "
+ this.getClass().getName() + "for: "
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestBmpGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.graphic;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
@@ -57,12 +58,12 @@
Assert.assertTrue(bmp.getColorSpace().getType() == ColorSpace.TYPE_RGB);
Assert.assertFalse(bmp.isTransparent());
Assert.assertNull(bmp.getTransparentColor());
- final byte[] content = bmp.getContent();
+ final ByteSequence content = bmp.getContent();
Assert.assertNotNull(content);
/* 70 pixel width * 62 pixel height = 4,340 pixels.
* 4,340 pixels * 3 channels * 8 bits per channel = 104,160 bits.
* 104,160 / 8 bits per byte = 13,020 bytes. */
- Assert.assertEquals(13020, content.length);
+ Assert.assertEquals(13020, content.length());
}
}
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestGifGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.graphic;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
@@ -64,12 +65,12 @@
final Color transparentColor = gif.getTransparentColor();
Assert.assertNotNull(transparentColor);
- final byte[] content = gif.getContent();
+ final ByteSequence content = gif.getContent();
Assert.assertNotNull(content);
/* 221 pixel width * 96 pixel height = 21,216 pixels.
* 21,216 pixels * 3 channels * 8 bits per channel = 509,184 bits.
* 509,184 / 8 bits per byte = 63,648 bytes. */
- Assert.assertEquals(63648, content.length);
+ Assert.assertEquals(63648, content.length());
}
/**
@@ -90,12 +91,12 @@
Assert.assertTrue(gif.isTransparent());
final Color transparentColor = gif.getTransparentColor();
Assert.assertNotNull(transparentColor);
- final byte[] content = gif.getContent();
+ final ByteSequence content = gif.getContent();
Assert.assertNotNull(content);
/* 221 pixel width * 96 pixel height = 21,216 pixels.
* 21,216 pixels * 3 channels * 8 bits per channel = 509,184 bits.
* 509,184 / 8 bits per byte = 63,648 bytes. */
- Assert.assertEquals(63648, content.length);
+ Assert.assertEquals(63648, content.length());
}
}
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestJpegGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.graphic;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
@@ -58,7 +59,7 @@
Assert.assertTrue(jpeg.getColorSpace().getType() == ColorSpace.TYPE_RGB);
Assert.assertFalse(jpeg.isTransparent());
Assert.assertNull(jpeg.getTransparentColor());
- final byte[] rawContent = jpeg.getRawSamples();
+ final ByteSequence rawContent = jpeg.getRawSamples();
Assert.assertNotNull(rawContent);
/* JPEG doesn't currently support returning the standard getContent(),
@@ -68,7 +69,7 @@
* 216 pixel width * 144 pixel height = 31,104 pixels.
* 31,104 pixels * 3 channels * 8 bits per channel = 746,496 bits.
* 746,496 / 8 bits per byte = 93,312 bytes. */
- Assert.assertEquals(13040, rawContent.length);
+ Assert.assertEquals(13040, rawContent.length());
}
}
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestPngGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.graphic;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
@@ -58,12 +59,12 @@
Assert.assertTrue(png.getColorSpace().getType() == ColorSpace.TYPE_RGB);
Assert.assertFalse(png.isTransparent());
Assert.assertNull(png.getTransparentColor());
- final byte[] content = png.getContent();
+ final ByteSequence content = png.getContent();
Assert.assertNotNull(content);
/* 216 pixel width * 144 pixel height = 31,104 pixels.
* 31,104 pixels * 3 channels * 8 bits per channel = 746,496 bits.
* 746,496 bits / 8 bits per byte = 93,312 bytes. */
- Assert.assertEquals(93312, content.length);
+ Assert.assertEquals(93312, content.length());
}
}
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TestTiffGraphic.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.graphic;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.GraphicException;
import org.junit.Assert;
@@ -58,7 +59,7 @@
Assert.assertTrue(tiff.getColorSpace().getType() == ColorSpace.TYPE_GRAY);
Assert.assertFalse(tiff.isTransparent());
Assert.assertNull(tiff.getTransparentColor());
- final byte[] content = tiff.getRawSamples();
+ final ByteSequence content = tiff.getRawSamples();
Assert.assertNotNull(content);
/* TIFF doesn't currently support returning the standard getContent(),
@@ -68,7 +69,7 @@
* 700 pixel width * 81 pixel height = 56,700 pixels.
* 56,700 pixels * 1 channels * 1 bits per channel = 56,700 bits.
* 56,700 / 8 bits per byte = 7,088 bytes. */
- Assert.assertEquals(1526, content.length);
+ Assert.assertEquals(1526, content.length());
}
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -28,6 +28,7 @@
package org.foray.pdf.object;
+import org.axsl.common.data.ByteSequence;
import org.axsl.pdf.PdfException;
import org.axsl.ps.PsEncodeFilter;
import org.axsl.ps.PsFilterType;
@@ -110,6 +111,27 @@
}
/**
+ * Writes a byte sequence to the stream content.
+ * This does <em>not</em> write anything to the related stream dictionary.
+ * @param content The bytes to be written.
+ * @throws PdfException For errors when writing.
+ */
+ public void write(final ByteSequence content) throws PdfException {
+ if (content == null) {
+ return;
+ }
+ this.filtersLocked = true;
+ try {
+ for (int index = 0; index < content.length(); index ++) {
+ this.out.write(content.byteAt(index));
+ }
+ } catch (final IOException e) {
+ throw new PdfException(e);
+ }
+ this.bytesWritten += content.length();
+ }
+
+ /**
* Add a filter for compression of the stream.
* Note that the filters should be added in reverse order, that is the last
* filter to be applied should be added first.
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -30,6 +30,7 @@
import org.foray.common.ps.BoundingBox4a;
+import org.axsl.common.data.ByteSequence;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.pdf.PdfException;
@@ -65,7 +66,7 @@
/* Write the content of the graphic file to an embedded file stream. */
final String efsName = this.getXObjectName() + "-EF";
final PdfEmbeddedFileStream embeddedFile = new PdfEmbeddedFileStream(doc, efsName);
- final byte[] efsContent = this.graphic.getContent();
+ final ByteSequence efsContent = this.graphic.getContent();
try {
embeddedFile.write(efsContent);
} catch (final PdfException e) {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pcl/PclRenderer.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -40,6 +40,7 @@
import org.foray.render.PrintRenderer;
import org.foray.render.Renderer;
+import org.axsl.common.data.ByteSequence;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
import org.axsl.galley.BookmarkTree;
@@ -386,7 +387,7 @@
boolean printBMP(final Graphic img, final int x, final int y, final int w,
final int h) throws GraphicException {
// Print the passed image file in PCL.
- final byte imgmap[] = img.getContent();
+ final ByteSequence imgmap = img.getContent();
int ix = 0;
int iy = 0;
@@ -439,14 +440,14 @@
// currentStream.add("\033*b" + bytewidth + "W");
for (ix = 0; ix < iw; ix++) {
if (iscolor) {
- cr = imgmap[indx++] & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
- cg = imgmap[indx++] & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
- cb = imgmap[indx++] & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
+ cr = imgmap.byteAt(indx++) & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
+ cg = imgmap.byteAt(indx++) & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
+ cb = imgmap.byteAt(indx++) & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
grey = (int) (cr * Renderer.SHADING_WEIGHT_RED
+ cg * Renderer.SHADING_WEIGHT_GREEN
+ cb * Renderer.SHADING_WEIGHT_BLUE);
} else {
- grey = imgmap[indx++] & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
+ grey = imgmap.byteAt(indx++) & WellKnownConstants.MAX_8_BIT_UNSIGNED_BYTE;
}
if (grey < WellKnownConstants.MAX_8_BIT_UNSIGNED_VALUES / 2) {
ib |= 1 << ((WellKnownConstants.BITS_PER_BYTE - 1)
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-14 04:04:28 UTC (rev 11784)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-01-14 11:06:36 UTC (rev 11785)
@@ -41,6 +41,7 @@
import org.foray.render.PrintRenderer;
import org.axsl.common.Gradient;
+import org.axsl.common.data.ByteSequence;
import org.axsl.common.data.IntSequence;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
@@ -692,7 +693,7 @@
buffer.append("");
final String string2 = buffer.toString();
final byte[] output = new byte[string1.length()
- + image.getContent().length
+ + image.getContent().length()
+ string2.length()];
int offset = 0;
System.arraycopy(string1.getBytes(), 0, output, offset,
@@ -699,8 +700,8 @@
string1.getBytes().length);
offset += string1.getBytes().length;
System.arraycopy(image.getContent(), 0, output, offset,
- image.getContent().length);
- offset += image.getContent().length;
+ image.getContent().length());
+ offset += image.getContent().length();
System.arraycopy(string2.getBytes(), 0, output, offset,
string2.getBytes().length);
return output;
@@ -723,7 +724,7 @@
try {
final boolean iscolor = img.getColorSpace().getType()
!= ColorSpace.TYPE_GRAY;
- final byte[] imgmap = img.getContent();
+ final ByteSequence imgmap = img.getContent();
write("gsave");
if (img.getColorSpace().getType() == ColorSpace.TYPE_CMYK) {
@@ -813,7 +814,9 @@
out = this.psServer.makeEncodeFilter(PsFilterType.RUN_LENGTH, out);
}
}
- out.write(imgmap);
+ for (int index = 0; index < imgmap.length(); index ++) {
+ out.write(imgmap.byteAt(index));
+ }
out.flush();
write("");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 04:04:36
|
Revision: 11784
http://sourceforge.net/p/foray/code/11784
Author: victormote
Date: 2021-01-14 04:04:28 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Conform to aXSL changes converting byte[] to ByteSequence.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXformEps.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1FontParser.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,10 +28,12 @@
package org.foray.font.format.type1;
+import org.foray.common.data.ByteArray;
import org.foray.common.io.RandomAccessInput;
import org.foray.font.format.FontParser;
import org.foray.font.format.FontParserClient;
+import org.axsl.common.data.ByteSequence;
import org.axsl.font.FontException;
import org.axsl.ps.PsException;
import org.axsl.ps.PsFontDictionary;
@@ -176,7 +178,7 @@
private byte segmentBeingParsed = 0;
@Override
- public byte[] providePostScriptInput() throws IOException {
+ public ByteSequence providePostScriptInput() throws IOException {
byte[] returnValue = null;
switch (this.segmentBeingParsed) {
case 0:
@@ -189,7 +191,7 @@
}
}
this.segmentBeingParsed ++;
- return returnValue;
+ return returnValue == null ? null : new ByteArray(returnValue);
}
};
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXformEps.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXformEps.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXformEps.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,6 +28,8 @@
package org.foray.pdf.object;
+import org.foray.common.data.ByteArray;
+
import org.axsl.graphic.EpsGraphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.PsBoundingBox;
@@ -83,8 +85,8 @@
} catch (final PsException e1) {
throw new GraphicException("Cannot parse EPS file.", e1);
}
- final byte[] pdfBytes = systemDict.getOutput();
- return pdfBytes;
+ final ByteArray pdfBytes = new ByteArray(systemDict.getOutput());
+ return pdfBytes.toArray();
}
@Override
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsFileReal.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,6 +28,9 @@
package org.foray.ps;
+import org.foray.common.data.ByteArray;
+
+import org.axsl.common.data.ByteSequence;
import org.axsl.ps.PsInput;
import java.io.File;
@@ -71,7 +74,8 @@
return tempChunk;
}
if (this.input != null) {
- tempChunk = this.input.providePostScriptInput();
+ final ByteSequence psInput = this.input.providePostScriptInput();
+ tempChunk = psInput == null ? null : new ByteArray(psInput).toArray();
} else if (this.value != null) {
// TODO: Handle i/o from real files
tempChunk = null;
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -29,7 +29,9 @@
package org.foray.ps;
import org.foray.common.WellKnownConstants;
+import org.foray.common.data.ByteArray;
+import org.axsl.common.data.ByteSequence;
import org.axsl.ps.PsInput;
import java.io.File;
@@ -58,7 +60,7 @@
}
@Override
- public byte[] providePostScriptInput() throws IOException {
+ public ByteSequence providePostScriptInput() throws IOException {
final byte[] buf = new byte[WellKnownConstants.BYTES_PER_KILOBYTE * 2];
final int bytesRead = this.in.read(buf);
if (bytesRead <= 0) {
@@ -66,7 +68,7 @@
}
final byte[] trimmed = new byte[bytesRead];
System.arraycopy(buf, 0, trimmed, 0, bytesRead);
- return trimmed;
+ return new ByteArray(trimmed);
}
}
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsStringInput.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,6 +28,9 @@
package org.foray.ps;
+import org.foray.common.data.ByteArray;
+
+import org.axsl.common.data.ByteSequence;
import org.axsl.ps.PsInput;
/**
@@ -50,12 +53,12 @@
}
@Override
- public byte[] providePostScriptInput() {
+ public ByteSequence providePostScriptInput() {
if (this.hasBeenConsumed) {
return null;
}
this.hasBeenConsumed = true;
- return this.wrappedString.getBytes();
+ return new ByteArray(this.wrappedString);
}
}
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/Java2dSystemDict.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -33,10 +33,13 @@
package org.foray.ps.java2d;
+import org.foray.common.data.ByteArray;
import org.foray.ps.PsDeviceException;
import org.foray.ps.PsNumber;
import org.foray.ps.PsSystemDict4a;
+import org.axsl.common.data.ByteSequence;
+
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
@@ -131,8 +134,8 @@
}
@Override
- public byte[] getOutput() {
- return new byte[0];
+ public ByteSequence getOutput() {
+ return ByteArray.EMPTY;
}
}
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/pdf/PdfSystemDict.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,11 +28,14 @@
package org.foray.ps.pdf;
+import org.foray.common.data.ByteArray;
import org.foray.ps.PsDeviceException;
import org.foray.ps.PsNumber;
import org.foray.ps.PsOperator;
import org.foray.ps.PsSystemDict4a;
+import org.axsl.common.data.ByteSequence;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -63,8 +66,8 @@
}
@Override
- public byte[] getOutput() {
- return this.stream.toByteArray();
+ public ByteSequence getOutput() {
+ return new ByteArray(this.stream.toByteArray());
}
/**
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2021-01-14 03:33:31 UTC (rev 11783)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2021-01-14 04:04:28 UTC (rev 11784)
@@ -28,9 +28,12 @@
package org.foray.ps.readonly;
+import org.foray.common.data.ByteArray;
import org.foray.ps.PsNumber;
import org.foray.ps.PsSystemDict4a;
+import org.axsl.common.data.ByteSequence;
+
/**
* PsSystemDict implementation that provides no painting or other rendering, but that is suitable
* for simple parsing of a PostScript file.
@@ -81,8 +84,8 @@
final float blue) { }
@Override
- public byte[] getOutput() {
- return new byte[0];
+ public ByteSequence getOutput() {
+ return ByteArray.EMPTY;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 03:33:34
|
Revision: 11783
http://sourceforge.net/p/foray/code/11783
Author: victormote
Date: 2021-01-14 03:33:31 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Conform to aXSL Panose changes.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TrueTypeFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableOs2.java
trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
Added Paths:
-----------
trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose4a.java
Removed Paths:
-------------
trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -31,12 +31,13 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.config.RegisteredFontDesc;
import org.foray.font.config.RegisteredFontFamily;
-import org.foray.font.format.Panose;
+import org.foray.font.format.Panose4a;
import org.axsl.font.Font;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontException;
import org.axsl.font.FontUse;
+import org.axsl.font.Panose;
import org.axsl.ps.Encoding;
import org.slf4j.Logger;
@@ -613,10 +614,10 @@
}
@Override
- public FontUse selectFontPanose(final byte[] panose, final int codePoint) {
- final Panose desiredPanose;
+ public FontUse selectFontPanose(final Panose panose, final int codePoint) {
+ final Panose4a desiredPanose;
try {
- desiredPanose = Panose.makeInstance(panose);
+ desiredPanose = Panose4a.makeInstance(panose);
} catch (final FontException e) {
return null;
}
@@ -625,7 +626,7 @@
for (RegisteredFontFamily rff : this.server.registeredFontFamilies()) {
for (int i = 0; i < rff.getFontDescriptions().size(); i++) {
final RegisteredFontDesc rfd = rff.getFontDescriptions().get(i);
- final Panose panoseInstance = rfd.getRegisteredFont()
+ final Panose4a panoseInstance = rfd.getRegisteredFont()
.getPanose();
final long difference = panoseInstance.difference(desiredPanose, null);
if (difference < bestDifference) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -32,7 +32,7 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.format.FontParser;
import org.foray.font.format.Kerning;
-import org.foray.font.format.Panose;
+import org.foray.font.format.Panose4a;
import org.axsl.font.Font;
import org.axsl.font.FontException;
@@ -117,7 +117,7 @@
private CharSet charSet;
/** The Panose for this font. */
- private Panose panose;
+ private Panose4a panose;
/** The complexity of this font. */
private Font.Complexity fontComplexity;
@@ -537,7 +537,7 @@
* Sets the Panose value for this font.
* @param panose The new Panose value.
*/
- protected void setPanose(final Panose panose) {
+ protected void setPanose(final Panose4a panose) {
this.panose = panose;
}
@@ -546,7 +546,7 @@
* @return The Panose instance for this font.
* @see #getPanose()
*/
- public Panose getPanoseInstance() {
+ public Panose4a getPanoseInstance() {
return this.panose;
}
@@ -555,11 +555,8 @@
* @see #getPanoseInstance()
*/
@Override
- public byte[] getPanose() {
- if (this.panose == null) {
- return null;
- }
- return this.panose.getPanoseArray();
+ public Panose4a getPanose() {
+ return this.panose;
}
@Override
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -33,6 +33,7 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.format.FontParser;
import org.foray.font.format.Kerning;
+import org.foray.font.format.Panose4a;
import org.axsl.font.FontException;
import org.axsl.ps.CharSet;
@@ -530,7 +531,7 @@
}
@Override
- public byte[] getPanose() {
+ public Panose4a getPanose() {
return null;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -39,7 +39,7 @@
import org.foray.font.SystemFont;
import org.foray.font.format.FontParser;
import org.foray.font.format.FontParserClient;
-import org.foray.font.format.Panose;
+import org.foray.font.format.Panose4a;
import org.foray.font.format.type1.Type1MetricsParser;
import org.axsl.font.Font;
@@ -494,7 +494,7 @@
* this font description.
* @return The Panose value for this instance.
*/
- public Panose getPanose() {
+ public Panose4a getPanose() {
if (this.hasFreeStandingFont()) {
return this.getFreeStandingFont().getPanoseInstance();
}
Deleted: trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -1,369 +0,0 @@
-/*
- * Copyright 2006 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.font.format;
-
-import org.axsl.font.FontException;
-
-
-/**
- * A PANOSE-1 classification number.
- *
- * <p>References:</p>
- * <ul>
- * <li><a href="http://fonts.apple.com/TTRefMan/RM06/Chap6OS2.html">The TTF OS/2 Table
- * doc</a></li>
- * <li><a href="http://www.w3.org/Fonts/Panose/pan2.html#StaticDigits">Panose 2.0 White
- * Paper</a></li>
- * <li><a href="http://www.byte.com/art/9405/sec12/art1.htm">The Panose Typeface-Matching
- * System</a></li>
- * <li>Michael S. De Laurentis, PANOSE 1.0 Core Mapper Services, Hewlett-Packard Document
- * EWC-93-0023b, Hewlett-Packard Corporation, 101 Stewart, Suite 700, Seattle, WA 98101 (1993).</li>
- * <li><a href="www.fonts.com/hp/panose/greybook">The "Grey Book"</a></li>
- * </ul>
- */
-public final class Panose {
-
- /**
- * Enumeration of the fields that comprise a PANOSE description.
- * @see "http://fonts.apple.com/TTRefMan/RM06/Chap6OS2.html"
- */
- public enum Field {
- /** The bFamilyType field. */
- FAMILY_TYPE((byte) 0, (byte) 5),
-
- /** The bSerifStyle field. */
- SERIF_STYLE((byte) 1, (byte) 15),
-
- /** The bWeight field. */
- WEIGHT((byte) 2, (byte) 11),
-
- /** The bProportion field. */
- PROPORTION((byte) 3, (byte) 9),
-
- /** The bContrast field. */
- CONTRAST((byte) 4, (byte) 9),
-
- /** The bStrokeVariatoon field. */
- STROKE_VARIATION((byte) 5, (byte) 8),
-
- /** The bArmStyle field. */
- ARM_STYLE((byte) 6, (byte) 11),
-
- /** The bLetterform field. */
- LETTERFORM((byte) 7, (byte) 15),
-
- /** The bMidline field. */
- MIDLINE((byte) 8, (byte) 13),
-
- /** The bXHeight field. */
- X_HEIGHT((byte) 9, (byte) 7);
-
- /** The 0-based index of this element in the PANOSE array. */
- private byte index;
-
- /** The maximum value that is permissible for this element. */
- private byte maxValue;
-
- /**
- * Private Constructor.
- * @param index The 0-based index of this element in the PANOSE array.
- * @param maxValue The maximum value that is permissible for this element.
- */
- Field(final byte index, final byte maxValue) {
- this.index = index;
- this.maxValue = maxValue;
- }
-
- /**
- * Returns the 0-based index of this element in the PANOSE array.
- * @return The 0-based index of this element in the PANOSE array.
- */
- public byte getIndex() {
- return this.index;
- }
-
- /**
- * Returns the maximum valid value for this field.
- * @return The maximum valid value for this field.
- */
- public byte getMaxValue() {
- return this.maxValue;
- }
-
- }
-
- /**
- * Constant indicating the minimum italic value for the letterform field.
- * This is based on an analysis of the MS ClearType Collection fonts:
- * <ul>
- * <li>consolas [ 2 11 6 9 2 2 4 3 2 4 ] bold 6 ital 3</li>
- * <li>consolas-bold [ 2 11 7 9 2 2 4 3 2 4 ] bold 7 ital 3</li>
- * <li>consolas-italic [ 2 11 6 9 2 2 4 10 2 4 ] bold 6 ital 10</li>
- * <li>consolas-bolditalic [ 2 11 7 9 2 2 4 10 2 4 ] bold 7 ital 10</li>
- *
- * <li>cordianew [ 2 11 3 4 2 2 2 2 2 4 ] bold 3 ital 2</li>
- * <li>cordianew-bolditalic [ 2 11 6 4 2 2 2 9 2 4 ] bold 6 ital 9</li>
- *
- * <li>calibri [ 2 15 5 2 2 2 4 3 2 4 ] bold 5 ital 3</li>
- * <li>calibri-bold [ 2 15 7 2 3 4 4 3 2 4 ] bold 7 ital 3</li>
- * <li>calibri-bolditalic [ 2 15 7 2 3 4 4 10 2 4 ] bold 7 ital 10</li>
- *
- * <li>constantia [ 2 3 6 2 5 3 6 3 3 3 ] bold 6 ital 3</li>
- * <li>constantia-bold [ 2 3 7 2 6 3 6 3 3 3 ] bold 7 ital 3 (note the 6 at index 4)</li>
- * <li>constantia-italic [ 2 3 6 2 5 3 6 10 3 3 ] bold 6 ital 10</li>
- *
- * <li>candara-bold [ 2 14 7 2 3 3 3 2 2 4 ] bold 7 ital 2</li>
- * <li>candara-italic [ 2 14 5 2 3 3 3 9 2 4 ] bold 5 ital 9</li>
- * <li>candara-bolditalic [ 2 14 7 2 3 3 3 9 2 4 ] bold 7 ital 9</li>
- *
- * <li>cambria-bold [ 2 4 8 3 5 4 6 3 2 4 ] bold 8 ital 3</li>
- * <li>cambria-italic [ 2 4 5 3 5 4 6 10 2 4 ] bold 5 ital 10</li>
- * </ul>
- */
- private static final byte LETTERFORM_MIN_ITALIC = 9;
-
- /**
- * Constant indicating the minimum bold value for the weight field.
- * This is based on an analysis of the MS ClearType Collection fonts, which can be found at
- * {@link #LETTERFORM_MIN_ITALIC}.
- */
- private static final byte WEIGHT_MIN_BOLD = 7;
-
- /** An array of weights indicating that all elements in a comparison between two PANOSE values
- * shall be considered to be of the same weight. */
- private static final byte[] NEUTRAL_WEIGHTS = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- /* Caveat: It is tempting to make NEUTRAL_WEIGHTS public and allow client apps to use it as a
- * parameter. However, there is no way to protect the data inside it from corruption, so we
- * have elected to keep it private and to allow "null" to be interpreted as the same value. */
-
- /** The encapsulated array of PANOSE numbers. */
- private byte[] panoseArray;
-
- /**
- * Private Constructor. Use {@link #makeInstance(byte[])} to create an instance of this class.
- * @param panoseArray The array of bytes recording the PANOSE classification.
- */
- private Panose(final byte[] panoseArray) {
- /* Clone the incoming array to protect our data from subsequent changes made to the original
- * array. */
- this.panoseArray = panoseArray.clone();
- }
-
- /**
- * Creates a new Panose instance, first checking it for validity.
- * @param panoseArray The array of bytes recording the PANOSE
- * classification.
- * @return The newly-created instance.
- * @throws FontException If {@code panoseArray} contains an illegal value.
- * @see #forceInstance(byte[])
- */
- public static Panose makeInstance(final byte[] panoseArray) throws FontException {
- final String panoseValidationMessage = Panose.validPanose(panoseArray);
- if (panoseValidationMessage != null) {
- throw new IllegalArgumentException("Illegal Panose Array: " + panoseValidationMessage);
- }
- return new Panose(panoseArray);
- }
-
- /**
- * Creates a new Panose instance without any error checking.
- * @param panoseArray The array of bytes recording the PANOSE classification.
- * @return The newly-created instance.
- * @see #makeInstance(byte[])
- */
- public static Panose forceInstance(final byte[] panoseArray) {
- return new Panose(panoseArray);
- }
-
- /**
- * Returns a clone of the the array of bytes representing the PANOSE number.
- * To avoid the cost of this cloning operation, use {@link #getElement(int)} to obtain the
- * value of individual elements in the array.
- * @return The PANOSE array.
- */
- public byte[] getPanoseArray() {
- return this.panoseArray.clone();
- }
-
- /**
- * Returns a given element from the underlying Panose array.
- * @param index The index to the element desired.
- * @return The value of the element at {@code index}.
- */
- public byte getElement(final int index) {
- return this.panoseArray[index];
- }
-
- /**
- * Returns a given element from the underlying Panose array.
- * @param field The field for which the value is desired.
- * @return The value of the element at {@code field}.
- */
- public byte getElement(final Panose.Field field) {
- final int index = field.getIndex();
- return getElement(index);
- }
-
- /**
- * Computes the weighted "closeness" of another Panose to this value.
- * @param otherPanose Another Panose instance which is being compared to this.
- * @param weights 10-element byte array of weights that should be used for each of the elements
- * in the comparison.
- * Values in this array must be between 0 and 127 inclusive.
- * (This constant is documented at http://www.w3.org/Fonts/Panose/pan2.html#StaticDigits).
- * Use null if all elements are to be weighted equally.
- * @return The weighted difference between the two Panose values.
- * A smaller value indicates that the two values are closer, and a larger
- * value indicates that they are farther apart.
- */
- public long difference(final Panose otherPanose, final byte[] weights) {
- /* This is a partial implementation of the "PANOSE Matching Heuristic" documented at:
- * http://www.w3.org/Fonts/Panose/pan2.html#Heuristic. **/
- byte[] weightsToUse = null;
- if (weights == null) {
- weightsToUse = Panose.NEUTRAL_WEIGHTS;
- } else {
- validateWeights(weights);
- weightsToUse = weights;
- }
- long difference = 0;
- for (int i = 0; i < Panose.Field.values().length; i++) {
-// final int digit = panoseDescription.length - i;
-// final int weight = (int) Math.round(Math.pow(2, digit - 1));
- final int weight = weightsToUse[i];
-
- final int thisDifference = this.getElement(i) - otherPanose.getElement(i);
- difference += weight * thisDifference * thisDifference;
- }
- return difference;
- }
-
- /**
- * Examines an array of weights, throwing various unchecked exceptions if the data is not valid.
- * @param weights The array of weights to be tested.
- */
- private static void validateWeights(final byte[] weights) {
- if (weights == null) {
- throw new NullPointerException("Weights may not be null");
- }
- if (weights.length != Panose.Field.values().length) {
- throw new IllegalArgumentException("Weights size expected: "
- + Panose.Field.values().length + ", actual: " + weights.length);
- }
- for (int i = 0; i < weights.length; i++) {
- final byte weight = weights[i];
- if (weight < 0
- || weight > Byte.MAX_VALUE) {
- throw new IllegalArgumentException("Weight element " + i + " is outside the range "
- + "of 0 thru 127.");
- }
- }
- }
-
- /**
- * Tests the validity of a panose description.
- * @param panoseDescription The panose values to be tested.
- * @return Null for a valid PANOSE description. For an invalid PANOSE description, returns a
- * descriptive message indicating which element is invalid.
- */
- public static String validPanose(final byte[] panoseDescription) {
- if (panoseDescription == null) {
- return "Panose description cannot be null.";
- }
- if (panoseDescription.length != Panose.Field.values().length) {
- return "Illegal Panose description size: " + panoseDescription.length;
- }
- for (int i = 0; i < panoseDescription.length; i++) {
- final byte theByte = panoseDescription[i];
- final Panose.Field panoseField = Panose.Field.values()[i];
- final byte maxValue = panoseField.getMaxValue();
- if (theByte < 0
- || theByte > maxValue) {
- return "Invalid value " + theByte + " > " + maxValue + " in position " + i
- + " of " + toString(panoseDescription);
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return toString(this.panoseArray);
- }
-
- /**
- * Returns a String representation of a Panose array.
- * @param panoseArray The Panose array to be expressed as a String.
- * @return The String representation of {@code panoseArray}.
- */
- private static String toString(final byte[] panoseArray) {
- final StringBuilder sb = new StringBuilder(30);
- sb.append("[ ");
- for (int i = 0; i < panoseArray.length; i++) {
- final byte theByte = panoseArray[i];
- sb.append(theByte + " ");
- }
- sb.append("]");
- return sb.toString();
- }
-
- /**
- * Returns the bold version of this Panose instance.
- * @return If this already describes a bold font, returns this. Otherwise, returns a new
- * Panose instance that is identical to this, except describing a bold font.
- */
- public Panose getBold() {
- final byte weightValue = this.getElement(Panose.Field.WEIGHT);
- if (weightValue >= Panose.WEIGHT_MIN_BOLD) {
- /* This Panose value is already bold. */
- return this;
- }
- final byte[] newArray = this.panoseArray.clone();
- newArray[Panose.Field.WEIGHT.getIndex()] = Panose.WEIGHT_MIN_BOLD;
- return Panose.forceInstance(newArray);
- }
-
- /**
- * Returns the italic version of this Panose instance.
- * @return If this already describes an italic font, returns this. Otherwise, returns a new
- * Panose instance that is identical to this, except describing an italic font.
- */
- public Panose getItalic() {
- final byte letterformValue = this.getElement(Panose.Field.LETTERFORM);
- if (letterformValue >= Panose.LETTERFORM_MIN_ITALIC) {
- /* This Panose value is already italic. */
- return this;
- }
- final byte[] newArray = this.panoseArray.clone();
- newArray[Panose.Field.LETTERFORM.getIndex()] = Panose.LETTERFORM_MIN_ITALIC;
- return Panose.forceInstance(newArray);
- }
-
-
-}
Copied: trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose4a.java (from rev 11775, trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose.java)
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose4a.java (rev 0)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/Panose4a.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -0,0 +1,444 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.font.format;
+
+import org.axsl.font.FontException;
+import org.axsl.font.Panose;
+
+
+/**
+ * A PANOSE-1 classification number.
+ *
+ * <p>References:</p>
+ * <ul>
+ * <li><a href="http://fonts.apple.com/TTRefMan/RM06/Chap6OS2.html">The TTF OS/2 Table
+ * doc</a></li>
+ * <li><a href="http://www.w3.org/Fonts/Panose/pan2.html#StaticDigits">Panose 2.0 White
+ * Paper</a></li>
+ * <li><a href="http://www.byte.com/art/9405/sec12/art1.htm">The Panose Typeface-Matching
+ * System</a></li>
+ * <li>Michael S. De Laurentis, PANOSE 1.0 Core Mapper Services, Hewlett-Packard Document
+ * EWC-93-0023b, Hewlett-Packard Corporation, 101 Stewart, Suite 700, Seattle, WA 98101 (1993).</li>
+ * <li><a href="www.fonts.com/hp/panose/greybook">The "Grey Book"</a></li>
+ * </ul>
+ */
+public final class Panose4a implements Panose {
+
+ /** The quantity of element in a Panose 1.0 array. */
+ private static final int QTY_PANOSE_ELEMENTS = 10;
+
+ /**
+ * Enumeration of the fields that comprise a PANOSE description.
+ * @see "http://fonts.apple.com/TTRefMan/RM06/Chap6OS2.html"
+ */
+ public enum Field {
+ /** The bFamilyType field. */
+ FAMILY_TYPE((byte) 0, (byte) 5),
+
+ /** The bSerifStyle field. */
+ SERIF_STYLE((byte) 1, (byte) 15),
+
+ /** The bWeight field. */
+ WEIGHT((byte) 2, (byte) 11),
+
+ /** The bProportion field. */
+ PROPORTION((byte) 3, (byte) 9),
+
+ /** The bContrast field. */
+ CONTRAST((byte) 4, (byte) 9),
+
+ /** The bStrokeVariatoon field. */
+ STROKE_VARIATION((byte) 5, (byte) 8),
+
+ /** The bArmStyle field. */
+ ARM_STYLE((byte) 6, (byte) 11),
+
+ /** The bLetterform field. */
+ LETTERFORM((byte) 7, (byte) 15),
+
+ /** The bMidline field. */
+ MIDLINE((byte) 8, (byte) 13),
+
+ /** The bXHeight field. */
+ X_HEIGHT((byte) 9, (byte) 7);
+
+ /** The 0-based index of this element in the PANOSE array. */
+ private byte index;
+
+ /** The maximum value that is permissible for this element. */
+ private byte maxValue;
+
+ /**
+ * Private Constructor.
+ * @param index The 0-based index of this element in the PANOSE array.
+ * @param maxValue The maximum value that is permissible for this element.
+ */
+ Field(final byte index, final byte maxValue) {
+ this.index = index;
+ this.maxValue = maxValue;
+ }
+
+ /**
+ * Returns the 0-based index of this element in the PANOSE array.
+ * @return The 0-based index of this element in the PANOSE array.
+ */
+ public byte getIndex() {
+ return this.index;
+ }
+
+ /**
+ * Returns the maximum valid value for this field.
+ * @return The maximum valid value for this field.
+ */
+ public byte getMaxValue() {
+ return this.maxValue;
+ }
+
+ }
+
+ /**
+ * Constant indicating the minimum italic value for the letterform field.
+ * This is based on an analysis of the MS ClearType Collection fonts:
+ * <ul>
+ * <li>consolas [ 2 11 6 9 2 2 4 3 2 4 ] bold 6 ital 3</li>
+ * <li>consolas-bold [ 2 11 7 9 2 2 4 3 2 4 ] bold 7 ital 3</li>
+ * <li>consolas-italic [ 2 11 6 9 2 2 4 10 2 4 ] bold 6 ital 10</li>
+ * <li>consolas-bolditalic [ 2 11 7 9 2 2 4 10 2 4 ] bold 7 ital 10</li>
+ *
+ * <li>cordianew [ 2 11 3 4 2 2 2 2 2 4 ] bold 3 ital 2</li>
+ * <li>cordianew-bolditalic [ 2 11 6 4 2 2 2 9 2 4 ] bold 6 ital 9</li>
+ *
+ * <li>calibri [ 2 15 5 2 2 2 4 3 2 4 ] bold 5 ital 3</li>
+ * <li>calibri-bold [ 2 15 7 2 3 4 4 3 2 4 ] bold 7 ital 3</li>
+ * <li>calibri-bolditalic [ 2 15 7 2 3 4 4 10 2 4 ] bold 7 ital 10</li>
+ *
+ * <li>constantia [ 2 3 6 2 5 3 6 3 3 3 ] bold 6 ital 3</li>
+ * <li>constantia-bold [ 2 3 7 2 6 3 6 3 3 3 ] bold 7 ital 3 (note the 6 at index 4)</li>
+ * <li>constantia-italic [ 2 3 6 2 5 3 6 10 3 3 ] bold 6 ital 10</li>
+ *
+ * <li>candara-bold [ 2 14 7 2 3 3 3 2 2 4 ] bold 7 ital 2</li>
+ * <li>candara-italic [ 2 14 5 2 3 3 3 9 2 4 ] bold 5 ital 9</li>
+ * <li>candara-bolditalic [ 2 14 7 2 3 3 3 9 2 4 ] bold 7 ital 9</li>
+ *
+ * <li>cambria-bold [ 2 4 8 3 5 4 6 3 2 4 ] bold 8 ital 3</li>
+ * <li>cambria-italic [ 2 4 5 3 5 4 6 10 2 4 ] bold 5 ital 10</li>
+ * </ul>
+ */
+ private static final byte LETTERFORM_MIN_ITALIC = 9;
+
+ /**
+ * Constant indicating the minimum bold value for the weight field.
+ * This is based on an analysis of the MS ClearType Collection fonts, which can be found at
+ * {@link #LETTERFORM_MIN_ITALIC}.
+ */
+ private static final byte WEIGHT_MIN_BOLD = 7;
+
+ /** An array of weights indicating that all elements in a comparison between two PANOSE values
+ * shall be considered to be of the same weight. */
+ private static final byte[] NEUTRAL_WEIGHTS = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ /* Caveat: It is tempting to make NEUTRAL_WEIGHTS public and allow client apps to use it as a
+ * parameter. However, there is no way to protect the data inside it from corruption, so we
+ * have elected to keep it private and to allow "null" to be interpreted as the same value. */
+
+ /** The encapsulated array of PANOSE numbers. */
+ private byte[] panoseArray;
+
+ /**
+ * Private Constructor. Use {@link #makeInstance(byte[])} to create an instance of this class.
+ * @param panoseArray The array of bytes recording the PANOSE classification.
+ */
+ private Panose4a(final byte[] panoseArray) {
+ /* Clone the incoming array to protect our data from subsequent changes made to the original
+ * array. */
+ this.panoseArray = panoseArray.clone();
+ }
+
+ /**
+ * Creates a new Panose instance, first checking it for validity.
+ * @param panoseArray The array of bytes recording the PANOSE
+ * classification.
+ * @return The newly-created instance.
+ * @throws FontException If {@code panoseArray} contains an illegal value.
+ * @see #forceInstance(byte[])
+ */
+ public static Panose4a makeInstance(final byte[] panoseArray) throws FontException {
+ final String panoseValidationMessage = Panose4a.validPanose(panoseArray);
+ if (panoseValidationMessage != null) {
+ throw new IllegalArgumentException("Illegal Panose Array: " + panoseValidationMessage);
+ }
+ return new Panose4a(panoseArray);
+ }
+
+ /**
+ * Creates a new Panose instance from another instance, first checking it for validity.
+ * @param panose The Panose instance to be copied.
+ * @return The newly-created instance.
+ * @throws FontException If {@code panoseArray} contains an illegal value.
+ * @see #makeInstance(byte[])
+ * @see #forceInstance(byte[])
+ */
+ public static Panose4a makeInstance(final Panose panose) throws FontException {
+ final byte[] array = new byte[QTY_PANOSE_ELEMENTS];
+ for (int index = 0; index < QTY_PANOSE_ELEMENTS; index ++) {
+ array[index] = (byte) panose.getValueAt(index);
+ }
+ return makeInstance(array);
+ }
+
+ /**
+ * Creates a new Panose instance without any error checking.
+ * @param panoseArray The array of bytes recording the PANOSE classification.
+ * @return The newly-created instance.
+ * @see #makeInstance(byte[])
+ */
+ public static Panose4a forceInstance(final byte[] panoseArray) {
+ return new Panose4a(panoseArray);
+ }
+
+ /**
+ * Returns a clone of the the array of bytes representing the PANOSE number.
+ * To avoid the cost of this cloning operation, use {@link #getElement(int)} to obtain the
+ * value of individual elements in the array.
+ * @return The PANOSE array.
+ */
+ public byte[] getPanoseArray() {
+ return this.panoseArray.clone();
+ }
+
+ /**
+ * Returns a given element from the underlying Panose array.
+ * @param index The index to the element desired.
+ * @return The value of the element at {@code index}.
+ */
+ public byte getElement(final int index) {
+ return this.panoseArray[index];
+ }
+
+ /**
+ * Returns a given element from the underlying Panose array.
+ * @param field The field for which the value is desired.
+ * @return The value of the element at {@code field}.
+ */
+ public byte getElement(final Panose4a.Field field) {
+ final int index = field.getIndex();
+ return getElement(index);
+ }
+
+ /**
+ * Computes the weighted "closeness" of another Panose to this value.
+ * @param otherPanose Another Panose instance which is being compared to this.
+ * @param weights 10-element byte array of weights that should be used for each of the elements
+ * in the comparison.
+ * Values in this array must be between 0 and 127 inclusive.
+ * (This constant is documented at http://www.w3.org/Fonts/Panose/pan2.html#StaticDigits).
+ * Use null if all elements are to be weighted equally.
+ * @return The weighted difference between the two Panose values.
+ * A smaller value indicates that the two values are closer, and a larger
+ * value indicates that they are farther apart.
+ */
+ public long difference(final Panose4a otherPanose, final byte[] weights) {
+ /* This is a partial implementation of the "PANOSE Matching Heuristic" documented at:
+ * http://www.w3.org/Fonts/Panose/pan2.html#Heuristic. **/
+ byte[] weightsToUse = null;
+ if (weights == null) {
+ weightsToUse = Panose4a.NEUTRAL_WEIGHTS;
+ } else {
+ validateWeights(weights);
+ weightsToUse = weights;
+ }
+ long difference = 0;
+ for (int i = 0; i < Panose4a.Field.values().length; i++) {
+// final int digit = panoseDescription.length - i;
+// final int weight = (int) Math.round(Math.pow(2, digit - 1));
+ final int weight = weightsToUse[i];
+
+ final int thisDifference = this.getElement(i) - otherPanose.getElement(i);
+ difference += weight * thisDifference * thisDifference;
+ }
+ return difference;
+ }
+
+ /**
+ * Examines an array of weights, throwing various unchecked exceptions if the data is not valid.
+ * @param weights The array of weights to be tested.
+ */
+ private static void validateWeights(final byte[] weights) {
+ if (weights == null) {
+ throw new NullPointerException("Weights may not be null");
+ }
+ if (weights.length != Panose4a.Field.values().length) {
+ throw new IllegalArgumentException("Weights size expected: "
+ + Panose4a.Field.values().length + ", actual: " + weights.length);
+ }
+ for (int i = 0; i < weights.length; i++) {
+ final byte weight = weights[i];
+ if (weight < 0
+ || weight > Byte.MAX_VALUE) {
+ throw new IllegalArgumentException("Weight element " + i + " is outside the range "
+ + "of 0 thru 127.");
+ }
+ }
+ }
+
+ /**
+ * Tests the validity of a panose description.
+ * @param panoseDescription The panose values to be tested.
+ * @return Null for a valid PANOSE description. For an invalid PANOSE description, returns a
+ * descriptive message indicating which element is invalid.
+ */
+ public static String validPanose(final byte[] panoseDescription) {
+ if (panoseDescription == null) {
+ return "Panose description cannot be null.";
+ }
+ if (panoseDescription.length != Panose4a.Field.values().length) {
+ return "Illegal Panose description size: " + panoseDescription.length;
+ }
+ for (int i = 0; i < panoseDescription.length; i++) {
+ final byte theByte = panoseDescription[i];
+ final Panose4a.Field panoseField = Panose4a.Field.values()[i];
+ final byte maxValue = panoseField.getMaxValue();
+ if (theByte < 0
+ || theByte > maxValue) {
+ return "Invalid value " + theByte + " > " + maxValue + " in position " + i
+ + " of " + toString(panoseDescription);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return toString(this.panoseArray);
+ }
+
+ /**
+ * Returns a String representation of a Panose array.
+ * @param panoseArray The Panose array to be expressed as a String.
+ * @return The String representation of {@code panoseArray}.
+ */
+ private static String toString(final byte[] panoseArray) {
+ final StringBuilder sb = new StringBuilder(30);
+ sb.append("[ ");
+ for (int i = 0; i < panoseArray.length; i++) {
+ final byte theByte = panoseArray[i];
+ sb.append(theByte + " ");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ /**
+ * Returns the bold version of this Panose instance.
+ * @return If this already describes a bold font, returns this. Otherwise, returns a new
+ * Panose instance that is identical to this, except describing a bold font.
+ */
+ public Panose4a getBold() {
+ final byte weightValue = this.getElement(Panose4a.Field.WEIGHT);
+ if (weightValue >= Panose4a.WEIGHT_MIN_BOLD) {
+ /* This Panose value is already bold. */
+ return this;
+ }
+ final byte[] newArray = this.panoseArray.clone();
+ newArray[Panose4a.Field.WEIGHT.getIndex()] = Panose4a.WEIGHT_MIN_BOLD;
+ return Panose4a.forceInstance(newArray);
+ }
+
+ /**
+ * Returns the italic version of this Panose instance.
+ * @return If this already describes an italic font, returns this. Otherwise, returns a new
+ * Panose instance that is identical to this, except describing an italic font.
+ */
+ public Panose4a getItalic() {
+ final byte letterformValue = this.getElement(Panose4a.Field.LETTERFORM);
+ if (letterformValue >= Panose4a.LETTERFORM_MIN_ITALIC) {
+ /* This Panose value is already italic. */
+ return this;
+ }
+ final byte[] newArray = this.panoseArray.clone();
+ newArray[Panose4a.Field.LETTERFORM.getIndex()] = Panose4a.LETTERFORM_MIN_ITALIC;
+ return Panose4a.forceInstance(newArray);
+ }
+
+ @Override
+ public int getFamilyKind() {
+ return this.getValueAt(Field.FAMILY_TYPE.getIndex());
+ }
+
+ @Override
+ public int getSerifStyle() {
+ return this.getValueAt(Field.SERIF_STYLE.getIndex());
+ }
+
+ @Override
+ public int getWeight() {
+ return this.getValueAt(Field.WEIGHT.getIndex());
+ }
+
+ @Override
+ public int getProportion() {
+ return this.getValueAt(Field.PROPORTION.getIndex());
+ }
+
+ @Override
+ public int getContrast() {
+ return this.getValueAt(Field.CONTRAST.getIndex());
+ }
+
+ @Override
+ public int getStrokeVariation() {
+ return this.getValueAt(Field.STROKE_VARIATION.getIndex());
+ }
+
+ @Override
+ public int getArmStyle() {
+ return this.getValueAt(Field.ARM_STYLE.getIndex());
+ }
+
+ @Override
+ public int getLetterform() {
+ return this.getValueAt(Field.LETTERFORM.getIndex());
+ }
+
+ @Override
+ public int getMidline() {
+ return this.getValueAt(Field.MIDLINE.getIndex());
+ }
+
+ @Override
+ public int getXheight() {
+ return this.getValueAt(Field.X_HEIGHT.getIndex());
+ }
+
+ @Override
+ public int getValueAt(final int index) {
+ return this.panoseArray[index];
+ }
+
+
+}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TrueTypeFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TrueTypeFont.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TrueTypeFont.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -33,7 +33,7 @@
import org.foray.common.primitive.BitUtils;
import org.foray.font.format.FontParserClient;
import org.foray.font.format.Kerning;
-import org.foray.font.format.Panose;
+import org.foray.font.format.Panose4a;
import org.foray.font.output.FontPdfUtilities;
import org.axsl.font.Font;
@@ -778,7 +778,7 @@
* Returns the parsed Panose information from the OS/2 table.
* @return The parsed Panose information.
*/
- public Panose getPanose() {
+ public Panose4a getPanose() {
return this.os2Table.getPanose();
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableOs2.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableOs2.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableOs2.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -29,7 +29,7 @@
package org.foray.font.format.ttf;
import org.foray.common.io.RandomAccessInput;
-import org.foray.font.format.Panose;
+import org.foray.font.format.Panose4a;
import java.io.IOException;
@@ -51,7 +51,7 @@
private short yStrikeoutPosition;
/** Array containing the Panose information. */
- private Panose panose;
+ private Panose4a panose;
/** The parsed typographic ascender for this font. */
private int sTypoAscender = 0;
@@ -111,11 +111,11 @@
/* Skip sFamilyClass. */
raInput.skipBytes(SHORT_BYTES);
/* Read the Panose array. */
- final byte[] panoseArray = new byte[Panose.Field.values().length];
+ final byte[] panoseArray = new byte[Panose4a.Field.values().length];
for (int i = 0; i < panoseArray.length; i++) {
panoseArray[i] = raInput.readByte();
}
- os2.panose = Panose.forceInstance(panoseArray);
+ os2.panose = Panose4a.forceInstance(panoseArray);
/* Skip ulUnicodeRange1. */
raInput.skipBytes(ULONG_BYTES);
/* Skip ulUnicodeRange2. */
@@ -186,7 +186,7 @@
* Returns the parsed PANOSE information from the font file.
* @return The parsed PANOSE information.
*/
- public Panose getPanose() {
+ public Panose4a getPanose() {
return this.panose;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-01-14 03:05:36 UTC (rev 11782)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-01-14 03:33:31 UTC (rev 11783)
@@ -35,6 +35,7 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
+import org.axsl.font.Panose;
import org.axsl.ps.Encoding;
/**
@@ -252,7 +253,7 @@
}
@Override
- public byte[] getPanose() {
+ public Panose getPanose() {
// TODO Auto-generated method stub
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-14 03:05:38
|
Revision: 11782
http://sourceforge.net/p/foray/code/11782
Author: victormote
Date: 2021-01-14 03:05:36 +0000 (Thu, 14 Jan 2021)
Log Message:
-----------
Add constructor for an existing byte sequence.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-13 19:20:05 UTC (rev 11781)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteArray.java 2021-01-14 03:05:36 UTC (rev 11782)
@@ -85,6 +85,18 @@
}
/**
+ * Constructor for another {@link ByteSequence}.
+ * @param sequence The byte sequence whose content is the content of the new array.
+ * This sequence is copied into an internal data structure to prevent it from being changed.
+ */
+ public ByteArray(final ByteSequence sequence) {
+ this.array = new byte[sequence.length()];
+ for (int index = 0; index < sequence.length(); index ++) {
+ this.array[index] = sequence.byteAt(index);
+ }
+ }
+
+ /**
* Constructor for a String or other CharSequence.
* The chars in the sequence will be converted to bytes using the "US-ASII" Charset.
* @param charSequence The String or other CharSequence whose character should be converted to bytes and
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 19:20:13
|
Revision: 11781
http://sourceforge.net/p/foray/code/11781
Author: victormote
Date: 2021-01-13 19:20:05 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Rename methods for clarity. Document that these methods write to the stream content, not the related dictionary.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfCmap.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfIccStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXform.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXimage.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfCmap.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfCmap.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfCmap.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -363,7 +363,7 @@
writeUseCMap(builder);
/* Add the accumulated content to the stream content. */
- add(builder.toString());
+ write(builder.toString());
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -88,7 +88,7 @@
*/
public void openTextObject() throws PdfException {
if (! this.textObjectOpen) {
- add("BT" + EOL);
+ write("BT" + EOL);
this.textObjectOpen = true;
}
}
@@ -99,7 +99,7 @@
*/
public void closeTextObject() throws PdfException {
if (this.textObjectOpen) {
- add("ET" + EOL);
+ write("ET" + EOL);
this.textObjectOpen = false;
}
}
@@ -108,7 +108,7 @@
public synchronized void setCursor(final float originX, final float originY)
throws PdfException {
openTextObject();
- add("1 0 0 1 " + originX + " " + originY + " Tm" + EOL);
+ write("1 0 0 1 " + originX + " " + originY + " Tm" + EOL);
}
@Override
@@ -120,7 +120,7 @@
openTextObject();
final CharSequence stringOut =
this.getGS().getFont().textToPdf(text, fontOptions, orthography);
- add(stringOut);
+ write(stringOut);
}
@Override
@@ -134,7 +134,7 @@
return;
}
final String psStyleName = newFont.getName();
- add("/" + psStyleName + " " + newFontSize + " Tf" + EOL);
+ write("/" + psStyleName + " " + newFontSize + " Tf" + EOL);
}
@Override
@@ -143,7 +143,7 @@
// Nothing needs to change.
return;
}
- add(newColor.getSetterString(false));
+ write(newColor.getSetterString(false));
}
@Override
@@ -152,7 +152,7 @@
// Nothing needs to change.
return;
}
- add(newColor.getSetterString(true));
+ write(newColor.getSetterString(true));
}
@Override
@@ -164,7 +164,7 @@
// Nothing needs to change.
return;
}
- add(newWordSpacing + " Tw" + EOL);
+ write(newWordSpacing + " Tw" + EOL);
}
@Override
@@ -176,7 +176,7 @@
// Nothing needs to change.
return;
}
- add(newCharacterSpacing + " Tc" + EOL);
+ write(newCharacterSpacing + " Tc" + EOL);
}
@Override
@@ -185,7 +185,7 @@
// Nothing needs to change.
return;
}
- add(newHorizontalScaling + " Tz" + EOL);
+ write(newHorizontalScaling + " Tz" + EOL);
}
@Override
@@ -194,7 +194,7 @@
// Nothing needs to change.
return;
}
- add(newLeading + " TL" + EOL);
+ write(newLeading + " TL" + EOL);
}
@Override
@@ -208,7 +208,7 @@
// Nothing needs to change.
return;
}
- add(mode.getModeValue() + " Tr" + EOL);
+ write(mode.getModeValue() + " Tr" + EOL);
}
@Override
@@ -217,7 +217,7 @@
// Nothing needs to change.
return;
}
- add(newTextRise + " Ts" + EOL);
+ write(newTextRise + " Ts" + EOL);
}
@Override
@@ -236,17 +236,17 @@
// Nothing needs to change.
return;
}
- add(newLineCapStyle.getPdfValue() + " J" + EOL);
+ write(newLineCapStyle.getPdfValue() + " J" + EOL);
}
@Override
public void drawLine(final Line2D.Float line) throws PdfException {
closeTextObject();
- add("q" + EOL);
- add(line.x1 + " " + line.y1 + " m" + EOL);
- add(line.x2 + " " + line.y2 + " l" + EOL);
- add("S" + EOL);
- add("Q" + EOL);
+ write("q" + EOL);
+ write(line.x1 + " " + line.y1 + " m" + EOL);
+ write(line.x2 + " " + line.y2 + " l" + EOL);
+ write("S" + EOL);
+ write("Q" + EOL);
}
@Override
@@ -257,22 +257,22 @@
return;
}
closeTextObject();
- add("q" + EOL);
+ write("q" + EOL);
/* Draw the rectangle. */
- add(rectangle.x + " " + rectangle.y + " " + rectangle.width + " "
+ write(rectangle.x + " " + rectangle.y + " " + rectangle.width + " "
+ rectangle.height + " re ");
if (stroke && fill) {
/* Close, fill, and stroke the rectangle. */
- add("b");
+ write("b");
} else if (stroke) {
/* Close and stroke the rectangle. */
- add("s");
+ write("s");
} else {
/* Fill the rectangle. */
- add("f");
+ write("f");
}
- add(EOL);
- add("Q" + EOL);
+ write(EOL);
+ write("Q" + EOL);
}
@Override
@@ -291,10 +291,10 @@
+ image.getUrl());
}
closeTextObject();
- add("q" + EOL);
+ write("q" + EOL);
clip(clipRectangle, contentRectangle);
try {
- add(xObject.getHorizontalScaling(contentRectangle)
+ write(xObject.getHorizontalScaling(contentRectangle)
+ " 0 0 "
+ xObject.getVerticalScaling(contentRectangle) + " "
+ contentRectangle.x + " "
@@ -303,8 +303,8 @@
} catch (final GraphicException e) {
throw new PdfException(e);
}
- add("/" + xObject.getXObjectName() + " Do" + EOL);
- add("Q" + EOL);
+ write("/" + xObject.getXObjectName() + " Do" + EOL);
+ write("Q" + EOL);
}
/**
@@ -324,24 +324,24 @@
return;
}
// Start a new path at the lower left corner.
- add(clipRectangle.getMinX() + " " + clipRectangle.getMinY() + " m"
+ write(clipRectangle.getMinX() + " " + clipRectangle.getMinY() + " m"
+ EOL);
// Append a line across the bottom of the rectangle (left-to-right).
- add(clipRectangle.getMaxX() + " " + clipRectangle.getMinY() + " l"
+ write(clipRectangle.getMaxX() + " " + clipRectangle.getMinY() + " l"
+ EOL);
// Append a line up the right side of the rectangle.
- add(clipRectangle.getMaxX() + " " + clipRectangle.getMaxY() + " l"
+ write(clipRectangle.getMaxX() + " " + clipRectangle.getMaxY() + " l"
+ EOL);
// Append a line across the top of the rectangle (right-to-left).
- add(clipRectangle.getMinX() + " " + clipRectangle.getMaxY() + " l"
+ write(clipRectangle.getMinX() + " " + clipRectangle.getMaxY() + " l"
+ EOL);
// Close the path and merge it with the clipping path
- add("h W n" + EOL);
+ write("h W n" + EOL);
}
@Override
public void setLineWidth(final float width) throws PdfException {
- add(width + " w" + EOL);
+ write(width + " w" + EOL);
}
@Override
@@ -350,16 +350,16 @@
// Nothing needs to change.
return;
}
- add("[");
+ write("[");
if (dashArray != null) {
for (int i = 0; i < dashArray.length; i++) {
if (i != 0) {
- add(" ");
+ write(" ");
}
- add(Float.toString(dashArray[i]));
+ write(Float.toString(dashArray[i]));
}
}
- add("] " + dashPhase + " d" + EOL);
+ write("] " + dashPhase + " d" + EOL);
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFontFileStream.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -61,7 +61,7 @@
/* The first filter specified is the last one applied. */
addFilter("ascii-85", doc);
addFilter("flate", doc);
- setData(fontFileStream);
+ write(fontFileStream);
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfIccStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfIccStream.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfIccStream.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -50,7 +50,7 @@
@Override
protected void finalizeStreamContent(final PdfDocument4a doc) throws PdfException {
- setData(this.cs.getProfile().getData());
+ write(this.cs.getProfile().getData());
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfStream.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -68,20 +68,22 @@
private boolean filtersLocked = false;
/**
- * Append data to the stream.
- * @param s The string of PDF to add.
+ * Writes a character sequence to the stream content, using the {@link PdfDocument4a#ENCODING} charset to convert
+ * the characters in the sequence to bytes.
+ * This does <em>not</em> write anything to the related stream dictionary.
+ * @param content The character sequence to be written.
* @throws PdfException For errors writing to output.
*/
- public void add(final CharSequence s) throws PdfException {
- /* TODO: This method has a similar purpose to setData(byte[]). Consider merging them. Actually, maybe they
- * need to be different. Maybe one writes the dictionary and the other the actual stream???? Only the other
- * one sets the filter locking and updates the count of bytes written. In any case, this needs to be cleaned
- * up and the logic and sequencing needs to be cleaned up or at least documented much better. */
+ public void write(final CharSequence content) throws PdfException {
+ if (content == null) {
+ return;
+ }
+ this.filtersLocked = true;
try {
try {
- this.out.write(s.toString().getBytes(PdfDocument4a.ENCODING));
+ this.out.write(content.toString().getBytes(PdfDocument4a.ENCODING));
} catch (final UnsupportedEncodingException ue) {
- this.out.write(s.toString().getBytes());
+ this.out.write(content.toString().getBytes());
}
} catch (final IOException ex) {
throw new PdfException(ex);
@@ -89,6 +91,25 @@
}
/**
+ * Writes a byte array to the stream content.
+ * This does <em>not</em> write anything to the related stream dictionary.
+ * @param content The bytes to be written.
+ * @throws PdfException For errors when writing.
+ */
+ public void write(final byte[] content) throws PdfException {
+ if (content == null) {
+ return;
+ }
+ this.filtersLocked = true;
+ try {
+ this.out.write(content);
+ } catch (final IOException e) {
+ throw new PdfException(e);
+ }
+ this.bytesWritten += content.length;
+ }
+
+ /**
* Add a filter for compression of the stream.
* Note that the filters should be added in reverse order, that is the last
* filter to be applied should be added first.
@@ -178,24 +199,6 @@
}
/**
- * Writes some data to this stream.
- * @param data The data to be written.
- * @throws PdfException For errors when writing.
- */
- public void setData(final byte[] data) throws PdfException {
- if (data == null) {
- return;
- }
- this.filtersLocked = true;
- try {
- this.out.write(data);
- } catch (final IOException e) {
- throw new PdfException(e);
- }
- this.bytesWritten += data.length;
- }
-
- /**
* Returns the number of bytes written to this stream.
* @return The number of bytes written to this stream.
*/
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfToUnicodeCmap.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -109,7 +109,7 @@
writeWrapUp(builder);
/* Add the accumulated content to the stream contents. */
- add(builder.toString());
+ write(builder.toString());
}
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXform.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXform.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXform.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -67,7 +67,7 @@
if (bytes == null) {
return;
}
- this.setData(bytes);
+ this.write(bytes);
}
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXimage.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXimage.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXimage.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -98,9 +98,9 @@
* TIFF is currently presumed to be compressed natively also,
* and an appropriate filter has been added for that
* compression. */
- this.setData(getGraphic().getRawSamples());
+ this.write(getGraphic().getRawSamples());
} else {
- this.setData(getGraphic().getContent());
+ this.write(getGraphic().getContent());
}
} catch (final GraphicException e) {
throw new PdfException(e);
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-13 15:00:18 UTC (rev 11780)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfXreference.java 2021-01-13 19:20:05 UTC (rev 11781)
@@ -67,7 +67,7 @@
final PdfEmbeddedFileStream embeddedFile = new PdfEmbeddedFileStream(doc, efsName);
final byte[] efsContent = this.graphic.getContent();
try {
- embeddedFile.setData(efsContent);
+ embeddedFile.write(efsContent);
} catch (final PdfException e) {
throw new GraphicException(e);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 15:00:26
|
Revision: 11780
http://sourceforge.net/p/foray/code/11780
Author: victormote
Date: 2021-01-13 15:00:18 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Document the pro-form changes needed to upgrade JEuclid to 3.1.9, and the reasons why we cannot currently do so.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
trunk/foray/master/build.gradle
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2021-01-13 12:26:32 UTC (rev 11779)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2021-01-13 15:00:18 UTC (rev 11780)
@@ -432,6 +432,44 @@
+ "MathML document, but was: " + rootElementName);
}
+ /*
+ * The pro-forma changes for upgrading to JEuclid 3.1.9 are as follows:
+ * 1. Change the ext.jeuclidVersion variable in the master build.gradle to '3.1.9'.
+ * 2. Uncomment the following section of code.
+ * 3. Remove the remainder of the code in this method.
+ * 4. Remove the method below this one, having the signature: SVGGraphics2D createSVGGenerator(MathBase).
+ *
+ * This looks like it /ought/ to work, and in fact compiles cleanly. However, at runtime, when testing MathML
+ * documents, it results in the following:
+ *
+ * Exception in thread "main" java.lang.AbstractMethodError:
+ * net.sourceforge.jeuclid.elements.presentation.token.Mo.getTextContent()Ljava/lang/String;
+ * at net.sourceforge.jeuclid.elements.support.text.TextContent.getText(TextContent.java:44)
+ * at net.sourceforge.jeuclid.elements.AbstractJEuclidElement.getText(AbstractJEuclidElement.java:413)
+ * ...
+ * at net.sourceforge.jeuclid.converter.BatikConverter.convert(BatikConverter.java:93)
+ * at net.sourceforge.jeuclid.converter.Converter.convert(Converter.java:214)
+ * at org.foray.graphic.GraphicServer4a.domToSvgDom(GraphicServer4a.java:436)
+ * ...
+ *
+ * This is an unusual exception, basically meaning that something unexpected happened between compile time and
+ * runtime. It may also be possible that there is some incompatibility between Java versions of code included
+ * in the JEuclid distribution, and/or the FOray dependencies.
+ *
+ * In any case, this appears to be unsolvable without building JEuclid ourselves, which does not currently
+ * (January 13, 2021) appear to be worth the effort.
+ */
+
+
+ /* Pro-forma JEuclid 3.1.9 code. See above. */
+ /*
+ final Converter converter = Converter.getInstance();
+ final LayoutContext layoutContext = LayoutContextImpl.getDefaultLayoutContext();
+ final DocumentWithDimension dwd = converter.convert(dom, Converter.TYPE_SVG, layoutContext);
+ return (SVGDocument) dwd.getDocument();
+ */
+
+
final MathBase mathBase = new MathBase(MathBase.getDefaultParameters());
new DOMBuilder(dom, mathBase);
final SVGGraphics2D svgGenerator = this.createSVGGenerator(mathBase);
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-13 12:26:32 UTC (rev 11779)
+++ trunk/foray/master/build.gradle 2021-01-13 15:00:18 UTC (rev 11780)
@@ -81,12 +81,19 @@
* our manual tests. Batik 1.6.1 requires a library that does not exist in the Maven repository.
*
* 8. JEuclid 3.1.9 will require handling some API changes.
+ * Making those API changes results in runtime problems, which are documented, along with the pro-forma necessary
+ * code changes, here:
+ * project: foray-graphic
+ * class: org.foray.graphic.GraphicServer4a
+ * method: org.w3c.dom.svg.SVGDocument domToSvgDom(org.w3c.dom.Document)
+ * JEuclid does not appear to be supported any longer, and I don't see any other MathML solutions with the right
+ * licensing. Therefore we will leave this dependency at 3.0.3 for now.
*
* 9. JUnit is compiled with Java 8 (major version 52) starting with release 5.0.0.
* We have therefore stayed with the highest version supporting Java 7, which is 4.13.1.
*
* 10. Mockito is compiled with Java 8 (major version 52) starting with release 3.0.0.
- * We have therefore stayed with the highest version supporting Java 7, which 2.28.2.
+ * We have therefore stayed with the highest version supporting Java 7, which 2.28.2.
*
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 12:26:34
|
Revision: 11779
http://sourceforge.net/p/foray/code/11779
Author: victormote
Date: 2021-01-13 12:26:32 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Remove the SVG document from the API.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java 2021-01-13 12:17:04 UTC (rev 11778)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java 2021-01-13 12:26:32 UTC (rev 11779)
@@ -48,7 +48,6 @@
import org.axsl.pdf.PdfPage;
import org.slf4j.Logger;
-import org.w3c.dom.svg.SVGDocument;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
@@ -175,7 +174,6 @@
* Create a new PdfGraphics2D with the given pdf document info.
* This is used to create a Graphics object for use inside an already existing document.
* @param textAsShapes Set this to true so that text will be rendered using curves and not the font.
- * @param svgDocument The SVG document to be drawn.
* @param fontConsumer The font consumer for this document.
* @param logger The logger.
* @param pdfContext The PDF context in which this content is being written.
@@ -182,7 +180,6 @@
* @param outputStream The output stream to which this processor writes its PDF output.
*/
public PdfGraphics2D(final boolean textAsShapes,
- final SVGDocument svgDocument,
final FontConsumer fontConsumer, final Logger logger,
final GraphicOutputContext pdfContext,
final OutputStream outputStream) {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java 2021-01-13 12:17:04 UTC (rev 11778)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java 2021-01-13 12:26:32 UTC (rev 11779)
@@ -133,9 +133,8 @@
builder = null;
final PdfGraphics2D graphics;
- graphics = new PdfGraphics2D(true, svgDocument, fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
- graphics.setGraphicContext(
- new org.apache.batik.ext.awt.g2d.GraphicContext());
+ graphics = new PdfGraphics2D(true, fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
+ graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
root.paint(graphics);
return graphics;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 12:17:11
|
Revision: 11778
http://sourceforge.net/p/foray/code/11778
Author: victormote
Date: 2021-01-13 12:17:04 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Remove no-longer-needed exception handling.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java 2021-01-13 11:25:46 UTC (rev 11777)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfGraphics2D.java 2021-01-13 12:17:04 UTC (rev 11778)
@@ -44,7 +44,6 @@
import org.axsl.font.FontOptions;
import org.axsl.font.FontUse;
import org.axsl.font.FontUtility;
-import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutputContext;
import org.axsl.pdf.PdfPage;
@@ -174,23 +173,19 @@
/**
* Create a new PdfGraphics2D with the given pdf document info.
- * This is used to create a Graphics object for use inside an already
- * existing document.
- * @param textAsShapes Set this to true so that text will be rendered
- * using curves and not the font.
+ * This is used to create a Graphics object for use inside an already existing document.
+ * @param textAsShapes Set this to true so that text will be rendered using curves and not the font.
* @param svgDocument The SVG document to be drawn.
* @param fontConsumer The font consumer for this document.
* @param logger The logger.
* @param pdfContext The PDF context in which this content is being written.
- * @param outputStream The output stream to which this processor writes its
- * PDF output.
- * @throws GraphicException If there is no graphical environment available.
+ * @param outputStream The output stream to which this processor writes its PDF output.
*/
public PdfGraphics2D(final boolean textAsShapes,
final SVGDocument svgDocument,
final FontConsumer fontConsumer, final Logger logger,
final GraphicOutputContext pdfContext,
- final OutputStream outputStream) throws GraphicException {
+ final OutputStream outputStream) {
super(textAsShapes);
/* TODO: Only write the comments if running in debug mode?? */
this.currentStream = new CharacterOutputStream(outputStream, true);
@@ -200,7 +195,6 @@
this.fontConsumer = fontConsumer;
this.pdfContext = pdfContext;
this.graphicsStateStack.push(new PdfGraphicsState(null));
- initGraphicalEnvironment();
}
/**
@@ -887,22 +881,6 @@
return new PdfGraphicsConfiguration();
}
- /**
- * Initializes the graphics environment, specifically by ensuring that one
- * exists.
- * @throws GraphicException If there is no graphical environment available.
- */
- private void initGraphicalEnvironment() throws GraphicException {
- try {
- final BufferedImage bi = new BufferedImage(1, 1,
- BufferedImage.TYPE_INT_ARGB);
- this.fmg = bi.createGraphics();
- } catch (final LinkageError e) {
- throw new GraphicException("Unable to create graphical "
- + "environment required to process SVG. Aborting.");
- }
- }
-
@Override
public FontMetrics getFontMetrics(final Font f) {
return this.fmg.getFontMetrics(f);
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java 2021-01-13 11:25:46 UTC (rev 11777)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgPdf.java 2021-01-13 12:17:04 UTC (rev 11778)
@@ -133,14 +133,7 @@
builder = null;
final PdfGraphics2D graphics;
- try {
- graphics = new PdfGraphics2D(true, svgDocument,
- fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
- } catch (final GraphicException e) {
- /* This exception is caused when no graphical environment exists. We check for that at
- * the beginning of this method, so this should never happen. */
- return null;
- }
+ graphics = new PdfGraphics2D(true, svgDocument, fontConsumer, this.svg.getLogger(), pdfContext, outputStream);
graphics.setGraphicContext(
new org.apache.batik.ext.awt.g2d.GraphicContext());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 11:25:49
|
Revision: 11777
http://sourceforge.net/p/foray/code/11777
Author: victormote
Date: 2021-01-13 11:25:46 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Add back dependency on Xerces, so that we have a working DOM Document implementation for MathML. Add an example of using an instream-foreign-object.
Modified Paths:
--------------
trunk/foray/foray-graphic/build.gradle
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java
trunk/foray/master/build.gradle
trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo
Modified: trunk/foray/foray-graphic/build.gradle
===================================================================
--- trunk/foray/foray-graphic/build.gradle 2021-01-13 00:55:27 UTC (rev 11776)
+++ trunk/foray/foray-graphic/build.gradle 2021-01-13 11:25:46 UTC (rev 11777)
@@ -3,6 +3,7 @@
dependencies {
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
api group: 'commons-io', name: 'commons-io', version: commonsIoVersion
+ api group: 'xerces', name: 'xercesImpl', version: xercesVersion
api group: 'org.apache.xmlgraphics', name: 'xmlgraphics-commons', version: xmlgraphicsCommonsVersion
api group: 'batik', name: 'batik-bridge', version: batikVersion
api group: 'batik', name: 'batik-gvt', version: batikVersion
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java 2021-01-13 00:55:27 UTC (rev 11776)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java 2021-01-13 11:25:46 UTC (rev 11777)
@@ -30,25 +30,24 @@
import org.foray.common.MathMlUtil;
+import org.apache.xerces.dom.DocumentImpl;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
+import org.w3c.dom.mathml.MathMLDocument;
-import java.util.HashMap;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import net.sourceforge.jeuclid.MathBase;
-import net.sourceforge.jeuclid.ParameterKey;
-import net.sourceforge.jeuclid.elements.generic.DocumentElement;
-
/**
* An implementation of the DOM MathMLDocument interface.
*/
-public final class MathMlDocument4a extends DocumentElement {
+public final class MathMlDocument4a extends DocumentImpl implements MathMLDocument {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -2103887514402824538L;
+
/** The MathML document type. */
private static DocumentType mathmlDocumentType;
@@ -78,8 +77,8 @@
*/
private MathMlDocument4a(final DocumentType documentType,
final String referrer, final String domain, final String uri) {
-// super(documentType);
- super(new MathBase(new HashMap<ParameterKey, String>()));
+ super(documentType);
+// super(new MathBase(new HashMap<ParameterKey, String>()));
this.referrer = referrer;
this.domain = domain;
this.uri = uri;
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-13 00:55:27 UTC (rev 11776)
+++ trunk/foray/master/build.gradle 2021-01-13 11:25:46 UTC (rev 11777)
@@ -33,24 +33,25 @@
ext.javaSourceCompatibility = JavaVersion.VERSION_1_7
ext.javaTargetCompatibility = JavaVersion.VERSION_1_7
- ext.axslVersion = '0.3-SNAPSHOT' // Latest is 0.3-SNAPSHOT as of 2021-01-12 See Note 2.
- ext.slf4jVersion = '1.7.30' // Latest is 1.7.30 as of 2021-01-12
- ext.commonsIoVersion = '2.6' // Latest is 2.8.0 as of 2021-01-12 See Note 3.
- ext.commonsDiscoveryVersion = '0.5' // Latest is 0.5 as of 2021-01-12
- ext.commonsCliVersion = '1.4' // Latest is 1.4 as of 2021-01-12
- ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12 See Note 4.
- ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12 See Note 5.
- ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12 See Note 6.
- ext.xmlgraphicsCommonsVersion = '2.4' // Latest is 2.4 as of 2021-01-12
- ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12 See Note 7.
- ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12 See Note 8.
- ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
+ ext.axslVersion = '0.3-SNAPSHOT' // Latest is 0.3-SNAPSHOT as of 2021-01-12. See Note 2.
+ ext.slf4jVersion = '1.7.30' // Latest is 1.7.30 as of 2021-01-12.
+ ext.commonsIoVersion = '2.6' // Latest is 2.8.0 as of 2021-01-12. See Note 3.
+ ext.commonsDiscoveryVersion = '0.5' // Latest is 0.5 as of 2021-01-12.
+ ext.commonsCliVersion = '1.4' // Latest is 1.4 as of 2021-01-12.
+ ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12. See Note 4.
+ ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12. See Note 5.
+ ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12. See Note 6.
+ ext.xercesVersion = '2.12.1' // Latest is 2.12.1 as of 2021-01-12.
+ ext.xmlgraphicsCommonsVersion = '2.4' // Latest is 2.4 as of 2021-01-12.
+ ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12. See Note 7.
+ ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12. See Note 8.
+ ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12.
- ext.junitVersion = '4.13.1' // Latest is 5.7.0 as of 2021-01-12 See Note 9.
- ext.mockitoVersion = '2.28.2' // Latest is 3.7.0 as of 2021-01-12 See Note 10.
- ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12
+ ext.junitVersion = '4.13.1' // Latest is 5.7.0 as of 2021-01-12. See Note 9.
+ ext.mockitoVersion = '2.28.2' // Latest is 3.7.0 as of 2021-01-12. See Note 10.
+ ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12.
- ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12
+ ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12.
/*
Modified: trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo
===================================================================
--- trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo 2021-01-13 00:55:27 UTC (rev 11776)
+++ trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo 2021-01-13 11:25:46 UTC (rev 11777)
@@ -230,14 +230,17 @@
<fo:block
font-size="16pt"
font-weight="bold"
- space-before.minimum="1em"
- space-before.optimum="1.5em"
- space-before.maximum="2em">A MathML Example in an external-graphic</fo:block>
+ space-after.minimum="1em"
+ space-after.optimum="1.5em"
+ space-after.maximum="2em">MathML Examples in an external-graphic</fo:block>
+
+ <fo:block>The following is from an external-graphic:</fo:block>
<fo:block>
<fo:external-graphic src="url('../graphics/mathml-example-1.xml')"/>
</fo:block>
- <fo:block>This formula is MathML code embedded in the FO.
+ <fo:block>This formula in this paragraph is from an fo:instream-foreign-object. In other words, the formula is
+ embedded in this document.
<fo:instream-foreign-object>
<math:math mode="display">
<math:mrow>
@@ -256,7 +259,7 @@
</math:mrow>
</math:math>
</fo:instream-foreign-object>
- The formula should be after the first sentence and before this one.
+ The formula should be placed immediately before this sentence.
</fo:block>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 00:55:30
|
Revision: 11776
http://sourceforge.net/p/foray/code/11776
Author: victormote
Date: 2021-01-13 00:55:27 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Rename package from sax to xml in preparation for new content.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentInputSource.java
trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentReader.java
trunk/foray/foray-common/src/main/java/org/foray/common/xml/package-info.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayDocument.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/PatternParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/util/NatLangParser.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/xml/
trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/sax/
trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -28,7 +28,7 @@
package org.foray.demo.embed.tools;
-import org.foray.common.sax.DocumentReader;
+import org.foray.common.xml.DocumentReader;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -30,8 +30,8 @@
import org.foray.app.ForaySpecific;
import org.foray.common.Environment;
-import org.foray.common.sax.SaxParser;
import org.foray.common.url.UrlFactory;
+import org.foray.common.xml.SaxParser;
import org.foray.core.ForayException;
import org.foray.core.SessionConfig;
import org.foray.fotree.FoTreeBuilder;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentInputSource.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sax/DocumentInputSource.java 2020-12-23 04:00:21 UTC (rev 11655)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentInputSource.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -26,7 +26,7 @@
* $LastChangedBy$
*/
-package org.foray.common.sax;
+package org.foray.common.xml;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentReader.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sax/DocumentReader.java 2020-12-23 04:00:21 UTC (rev 11655)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/DocumentReader.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -26,7 +26,7 @@
* $LastChangedBy$
*/
-package org.foray.common.sax;
+package org.foray.common.xml;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sax/SaxParser.java 2020-12-23 04:00:21 UTC (rev 11655)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -1,83 +0,0 @@
-/*
- * Copyright 2005 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy: victormote $
- */
-
-package org.foray.common.sax;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- * Utility class that provides information about an XML Parser.
- */
-public final class SaxParser {
-
- /**
- * Private constructor (should not be instantiated).
- */
- private SaxParser() {
- }
-
- /**
- * Returns the name of the SAX Parser class that is found in the classpath.
- * @return The name of the SAX Parser class that is found in the classpath.
- */
- public static String getParserClassName() {
- try {
- return SAXParserFactory.newInstance().newSAXParser()
- .getXMLReader().getClass().getName();
- } catch (final ParserConfigurationException e) {
- return null;
- } catch (final SAXException e) {
- return null;
- }
- }
-
- /**
- * Creates a SAX2 parser with a standard configuration. Specifically,
- * the parser is namespace-aware and has the "namespace-prefixes" feature
- * set to true.
- * @return The newly-created SAX2 parser.
- * @throws SAXException For errors creating the parser.
- * @throws ParserConfigurationException For errors configuring the parser.
- */
- public static XMLReader createSax2Parser() throws SAXException,
- ParserConfigurationException {
- final SAXParserFactory spf =
- javax.xml.parsers.SAXParserFactory.newInstance();
- spf.setNamespaceAware(true);
- XMLReader xmlReader = null;
- xmlReader = spf.newSAXParser().getXMLReader();
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes",
- true);
- return xmlReader;
- }
-
-}
Copied: trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java (from rev 11767, trunk/foray/foray-common/src/main/java/org/foray/common/sax/SaxParser.java)
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.common.xml;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+/**
+ * Utility class that provides information about an XML Parser.
+ */
+public final class SaxParser {
+
+ /**
+ * Private constructor (should not be instantiated).
+ */
+ private SaxParser() {
+ }
+
+ /**
+ * Returns the name of the SAX Parser class that is found in the classpath.
+ * @return The name of the SAX Parser class that is found in the classpath.
+ */
+ public static String getParserClassName() {
+ try {
+ return SAXParserFactory.newInstance().newSAXParser()
+ .getXMLReader().getClass().getName();
+ } catch (final ParserConfigurationException e) {
+ return null;
+ } catch (final SAXException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Creates a SAX2 parser with a standard configuration. Specifically,
+ * the parser is namespace-aware and has the "namespace-prefixes" feature
+ * set to true.
+ * @return The newly-created SAX2 parser.
+ * @throws SAXException For errors creating the parser.
+ * @throws ParserConfigurationException For errors configuring the parser.
+ */
+ public static XMLReader createSax2Parser() throws SAXException, ParserConfigurationException {
+ final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = null;
+ xmlReader = spf.newSAXParser().getXMLReader();
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ return xmlReader;
+ }
+
+}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/xml/package-info.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sax/package-info.java 2020-12-23 04:00:21 UTC (rev 11655)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/package-info.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -30,4 +30,4 @@
* <p>Classes useful with SAX.</p>
*/
-package org.foray.common.sax;
+package org.foray.common.xml;
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayDocument.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayDocument.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayDocument.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -28,9 +28,9 @@
package org.foray.core;
-import org.foray.common.sax.DocumentInputSource;
-import org.foray.common.sax.DocumentReader;
-import org.foray.common.sax.SaxParser;
+import org.foray.common.xml.DocumentInputSource;
+import org.foray.common.xml.DocumentReader;
+import org.foray.common.xml.SaxParser;
import org.axsl.area.AreaTreeFactory;
import org.axsl.font.FontConsumer;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -30,8 +30,8 @@
import org.foray.common.MathMlUtil;
import org.foray.common.SvgUtil;
-import org.foray.common.sax.SaxParser;
import org.foray.common.url.UrlUtil;
+import org.foray.common.xml.SaxParser;
import org.foray.graphic.factory.BmpFactory;
import org.foray.graphic.factory.EpsFactory;
import org.foray.graphic.factory.GifFactory;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/PatternParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/PatternParser.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/PatternParser.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -34,7 +34,7 @@
package org.foray.hyphen;
import org.foray.common.ForayConstants;
-import org.foray.common.sax.SaxParser;
+import org.foray.common.xml.SaxParser;
import org.axsl.hyphen.HyphenationException;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/util/NatLangParser.java 2021-01-13 00:52:52 UTC (rev 11775)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/util/NatLangParser.java 2021-01-13 00:55:27 UTC (rev 11776)
@@ -36,7 +36,7 @@
import org.foray.common.AxslDtdUtil;
import org.foray.common.ForayConstants;
import org.foray.common.primitive.UnicodeCharUtils;
-import org.foray.common.sax.SaxParser;
+import org.foray.common.xml.SaxParser;
import org.axsl.hyphen.HyphenationException;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 00:52:54
|
Revision: 11775
http://sourceforge.net/p/foray/code/11775
Author: victormote
Date: 2021-01-13 00:52:52 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Add inline MathML fragment.
Modified Paths:
--------------
trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo
Modified: trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo
===================================================================
--- trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo 2021-01-13 00:40:26 UTC (rev 11774)
+++ trunk/foray/master/dist/resource/fo-examples/basic/graphics.fo 2021-01-13 00:52:52 UTC (rev 11775)
@@ -2,6 +2,7 @@
<fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
font-family="Times Roman"
font-size="12pt"
text-align="center"
@@ -231,11 +232,34 @@
font-weight="bold"
space-before.minimum="1em"
space-before.optimum="1.5em"
- space-before.maximum="2em">A MathML Example</fo:block>
+ space-before.maximum="2em">A MathML Example in an external-graphic</fo:block>
<fo:block>
<fo:external-graphic src="url('../graphics/mathml-example-1.xml')"/>
</fo:block>
+ <fo:block>This formula is MathML code embedded in the FO.
+ <fo:instream-foreign-object>
+ <math:math mode="display">
+ <math:mrow>
+ <math:mo>(</math:mo>
+ <math:mfrac linethickness="1">
+ <math:mrow>
+ <math:mi>h</math:mi>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>k</math:mi>
+ <math:mo>/</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ </math:mfrac>
+ <math:mo>)</math:mo>
+ </math:mrow>
+ </math:math>
+ </fo:instream-foreign-object>
+ The formula should be after the first sentence and before this one.
+ </fo:block>
+
+
</fo:flow>
</fo:page-sequence>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-13 00:40:29
|
Revision: 11774
http://sourceforge.net/p/foray/code/11774
Author: victormote
Date: 2021-01-13 00:40:26 +0000 (Wed, 13 Jan 2021)
Log Message:
-----------
Fix address of DTD.
Modified Paths:
--------------
trunk/foray/master/dist/resource/fo-examples/graphics/mathml-example-1.xml
Modified: trunk/foray/master/dist/resource/fo-examples/graphics/mathml-example-1.xml
===================================================================
--- trunk/foray/master/dist/resource/fo-examples/graphics/mathml-example-1.xml 2021-01-12 23:20:56 UTC (rev 11773)
+++ trunk/foray/master/dist/resource/fo-examples/graphics/mathml-example-1.xml 2021-01-13 00:40:26 UTC (rev 11774)
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE math
PUBLIC "-//W3C//DTD MathML 2.0//EN"
- "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
+ "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
@@ -15,4 +15,4 @@
<mi>t</mi>
</mfrac>
</mrow>
-</math>
\ No newline at end of file
+</math>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-12 23:20:57
|
Revision: 11773
http://sourceforge.net/p/foray/code/11773
Author: victormote
Date: 2021-01-12 23:20:56 +0000 (Tue, 12 Jan 2021)
Log Message:
-----------
Upgrade Apache XML Graphics Commons to 2.4.
Modified Paths:
--------------
trunk/foray/master/build.gradle
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-12 22:07:22 UTC (rev 11772)
+++ trunk/foray/master/build.gradle 2021-01-12 23:20:56 UTC (rev 11773)
@@ -41,7 +41,7 @@
ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12 See Note 4.
ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12 See Note 5.
ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12 See Note 6.
- ext.xmlgraphicsCommonsVersion = '1.4' // Latest is 2.4 as of 2021-01-12
+ ext.xmlgraphicsCommonsVersion = '2.4' // Latest is 2.4 as of 2021-01-12
ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12 See Note 7.
ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12 See Note 8.
ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-12 22:07:24
|
Revision: 11772
http://sourceforge.net/p/foray/code/11772
Author: victormote
Date: 2021-01-12 22:07:22 +0000 (Tue, 12 Jan 2021)
Log Message:
-----------
Update doc about JUnit version.
Modified Paths:
--------------
trunk/foray/master/build.gradle
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-12 21:55:04 UTC (rev 11771)
+++ trunk/foray/master/build.gradle 2021-01-12 22:07:22 UTC (rev 11772)
@@ -46,8 +46,8 @@
ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12 See Note 8.
ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
- ext.junitVersion = '4.13.1' // Latest is 4.13.1 as of 2021-01-12
- ext.mockitoVersion = '2.28.2' // Latest is 3.7.0 as of 2021-01-12 See Note 9.
+ ext.junitVersion = '4.13.1' // Latest is 5.7.0 as of 2021-01-12 See Note 9.
+ ext.mockitoVersion = '2.28.2' // Latest is 3.7.0 as of 2021-01-12 See Note 10.
ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12
ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12
@@ -56,33 +56,37 @@
/*
* Notes on Dependency Releases (See above for references)
* ========================================================
- * 1. Latest release information above is per www.mvnrepository.com, and ignores non-released artifacts (no alpha or
- * beta releases, except for aXSL).
+ * 1. Latest release information above is per www.mvnrepository.com, and ignores non-released artifacts (no alpha or
+ * beta releases, except for aXSL).
*
- * 2. At the moment, and for the foreseeable future, aXSL is controlled by FOray, as we attempt to get the module APIs
- * cleaned up and robust.
+ * 2. At the moment, and for the foreseeable future, aXSL is controlled by FOray, as we attempt to get the module APIs
+ * cleaned up and robust.
*
- * 3. Apache Commons IO releases, starting at 2.7, are compiled with Java 1.8 (major version 52), which produces
- * compile-time warnings when we try to build with Java 1.7.
- * We have therefore stayed with the highest version that supports the Java 1.7 compiler, which is 2.6.
+ * 3. Apache Commons IO releases, starting at 2.7, are compiled with Java 1.8 (major version 52), which produces
+ * compile-time warnings when we try to build with Java 1.7.
+ * We have therefore stayed with the highest version that supports the Java 1.7 compiler, which is 2.6.
*
- * 4. It looks like the catalog resolver code is part of Java 1.9.
+ * 4. It looks like the catalog resolver code is part of Java 1.9.
*
- * 5. Ant 1.10.9 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try to
- * build with Java 1.7.
- * We have therefore stayed with the highest version of 1.9, which is 1.9.15.
+ * 5. Ant 1.10.9 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try to
+ * build with Java 1.7.
+ * We have therefore stayed with the highest version of 1.9, which is 1.9.15.
*
- * 6. Servlet-api 4.0.1 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try
- * to build with Java 1.7.
- * We have therefore stayed with the hight version of 3.0, which is 3.1.0.
+ * 6. Servlet-api 4.0.1 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try
+ * to build with Java 1.7.
+ * We have therefore stayed with the hight version of 3.0, which is 3.1.0.
*
- * 7. Batik 1.13 will require handling some API changes. Batik 1.7 causes a NullPointerException when running one of
- * our manual tests. Batik 1.6.1 requires a library that does not exist in the Maven repository.
+ * 7. Batik 1.13 will require handling some API changes. Batik 1.7 causes a NullPointerException when running one of
+ * our manual tests. Batik 1.6.1 requires a library that does not exist in the Maven repository.
*
- * 8. JEuclid 3.1.9 will require handling some API changes.
+ * 8. JEuclid 3.1.9 will require handling some API changes.
*
- * 9. Mockito is compiled with Java 8 (major version 52) starting with release 3.0.0.
- * We have therefore stayed with the highest version supporting Java 7, which 2.28.2.
+ * 9. JUnit is compiled with Java 8 (major version 52) starting with release 5.0.0.
+ * We have therefore stayed with the highest version supporting Java 7, which is 4.13.1.
+ *
+ * 10. Mockito is compiled with Java 8 (major version 52) starting with release 3.0.0.
+ * We have therefore stayed with the highest version supporting Java 7, which 2.28.2.
+ *
*/
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-12 21:55:06
|
Revision: 11771
http://sourceforge.net/p/foray/code/11771
Author: victormote
Date: 2021-01-12 21:55:04 +0000 (Tue, 12 Jan 2021)
Log Message:
-----------
Update Mockito to latest version compatible with Java 7.
Modified Paths:
--------------
trunk/foray/master/build.gradle
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-12 21:35:28 UTC (rev 11770)
+++ trunk/foray/master/build.gradle 2021-01-12 21:55:04 UTC (rev 11771)
@@ -33,25 +33,24 @@
ext.javaSourceCompatibility = JavaVersion.VERSION_1_7
ext.javaTargetCompatibility = JavaVersion.VERSION_1_7
- ext.axslVersion = '0.3-SNAPSHOT'
- ext.slf4jVersion = '1.7.30' // Latest is 1.7.30 as of 2021-01-12
- ext.commonsIoVersion = '2.6' // Latest is 2.8.0 as of 2021-01-12 See Note 6.
- ext.commonsDiscoveryVersion = '0.5' // Latest is 0.5 as of 2021-01-12
- ext.commonsCliVersion = '1.4' // Latest is 1.4 as of 2021-01-12
- ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12
- ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12 See Note 2.
- ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12 See Note 3.
- ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12
- ext.xmlgraphicsCommonsVersion = '1.4' // Latest is 2.4 as of 2021-01-12
- ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12 See Note 4.
- ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12 See Note 5.
- ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
+ ext.axslVersion = '0.3-SNAPSHOT' // Latest is 0.3-SNAPSHOT as of 2021-01-12 See Note 2.
+ ext.slf4jVersion = '1.7.30' // Latest is 1.7.30 as of 2021-01-12
+ ext.commonsIoVersion = '2.6' // Latest is 2.8.0 as of 2021-01-12 See Note 3.
+ ext.commonsDiscoveryVersion = '0.5' // Latest is 0.5 as of 2021-01-12
+ ext.commonsCliVersion = '1.4' // Latest is 1.4 as of 2021-01-12
+ ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12 See Note 4.
+ ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12 See Note 5.
+ ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12 See Note 6.
+ ext.xmlgraphicsCommonsVersion = '1.4' // Latest is 2.4 as of 2021-01-12
+ ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12 See Note 7.
+ ext.jeuclidVersion = '3.0.3' // Latest is 3.1.9 as of 2021-01-12 See Note 8.
+ ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
- ext.junitVersion = '4.13.1' // Latest is 4.13.1 as of 2021-01-12
- ext.mockitoVersion = '2.25.1' // Latest is 3.7.0 as of 2021-01-12
- ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12
+ ext.junitVersion = '4.13.1' // Latest is 4.13.1 as of 2021-01-12
+ ext.mockitoVersion = '2.28.2' // Latest is 3.7.0 as of 2021-01-12 See Note 9.
+ ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12
- ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12
+ ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12
/*
@@ -58,24 +57,32 @@
* Notes on Dependency Releases (See above for references)
* ========================================================
* 1. Latest release information above is per www.mvnrepository.com, and ignores non-released artifacts (no alpha or
- * beta releases).
+ * beta releases, except for aXSL).
*
- * 2. Ant 1.10.9 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try to
+ * 2. At the moment, and for the foreseeable future, aXSL is controlled by FOray, as we attempt to get the module APIs
+ * cleaned up and robust.
+ *
+ * 3. Apache Commons IO releases, starting at 2.7, are compiled with Java 1.8 (major version 52), which produces
+ * compile-time warnings when we try to build with Java 1.7.
+ * We have therefore stayed with the highest version that supports the Java 1.7 compiler, which is 2.6.
+ *
+ * 4. It looks like the catalog resolver code is part of Java 1.9.
+ *
+ * 5. Ant 1.10.9 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try to
* build with Java 1.7.
* We have therefore stayed with the highest version of 1.9, which is 1.9.15.
*
- * 3. Servlet-api 4.0.1 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try
+ * 6. Servlet-api 4.0.1 is compiled with Java 1.8 (major version 52), which produces compile-time warnings when we try
* to build with Java 1.7.
* We have therefore stayed with the hight version of 3.0, which is 3.1.0.
*
- * 4. Batik 1.13 will require handling some API changes. Batik 1.7 causes a NullPointerException when running one of
+ * 7. Batik 1.13 will require handling some API changes. Batik 1.7 causes a NullPointerException when running one of
* our manual tests. Batik 1.6.1 requires a library that does not exist in the Maven repository.
*
- * 5. JEuclid 3.1.9 will require handling some API changes.
+ * 8. JEuclid 3.1.9 will require handling some API changes.
*
- * 6. Apache Commons IO releases, starting at 2.7, are compiled with Java 1.8 (major version 52), which produces
- * compile-time warnings when we try to build with Java 1.7.
- * We have therefore stayed with the highest version that supports the Java 1.7 compiler, which is 2.6.
+ * 9. Mockito is compiled with Java 8 (major version 52) starting with release 3.0.0.
+ * We have therefore stayed with the highest version supporting Java 7, which 2.28.2.
*/
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-01-12 21:35:31
|
Revision: 11770
http://sourceforge.net/p/foray/code/11770
Author: victormote
Date: 2021-01-12 21:35:28 +0000 (Tue, 12 Jan 2021)
Log Message:
-----------
Remove last dependency on Xerces.
Modified Paths:
--------------
trunk/foray/foray-font/build.gradle
trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java
trunk/foray/master/build.gradle
Modified: trunk/foray/foray-font/build.gradle
===================================================================
--- trunk/foray/foray-font/build.gradle 2021-01-12 21:14:24 UTC (rev 11769)
+++ trunk/foray/foray-font/build.gradle 2021-01-12 21:35:28 UTC (rev 11770)
@@ -3,7 +3,6 @@
dependencies {
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
api group: 'commons-io', name: 'commons-io', version: commonsIoVersion
- api group: 'xerces', name: 'xercesImpl', version: xercesImplVersion
api group: 'commons-discovery', name: 'commons-discovery', version: commonsDiscoveryVersion
api group: 'org.apache.ant', name: 'ant-launcher', version: antVersion
api group: 'commons-cli', name: 'commons-cli', version: commonsCliVersion
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java 2021-01-12 21:14:24 UTC (rev 11769)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java 2021-01-12 21:35:28 UTC (rev 11770)
@@ -40,8 +40,8 @@
import org.apache.commons.io.IOCase;
import org.apache.commons.io.filefilter.WildcardFileFilter;
-import org.apache.xerces.dom.DOMImplementationImpl;
import org.slf4j.Logger;
+import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
@@ -65,6 +65,9 @@
import java.util.Map;
import javax.activation.URLDataSource;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
/**
* <p>Creates a default axsl-compliant font-configuration file from fonts in a
@@ -113,14 +116,21 @@
public Document getDom() {
removeDuplicates();
sort();
- final DOMImplementationImpl domImpl = new DOMImplementationImpl();
- final DocumentType docType = domImpl.createDocumentType(
- "axsl-font-config",
+
+ final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = null;
+ try {
+ builder = factory.newDocumentBuilder();
+ } catch (final ParserConfigurationException e) {
+ getLogger().error("Unable to create DocumentBuilder", e);
+ }
+ final DOMImplementation implementation = builder.getDOMImplementation();
+ final DocumentType docType = implementation.createDocumentType("axsl-font-config",
"-//aXSL//DTD Font Configuration V0.1//EN",
"http://www.axsl.org/dtds/0.1/en/axsl-font-config.dtd");
- final Document doc = domImpl.createDocument(null, "axsl-font-config",
- docType);
- final Element rootElement = doc.getDocumentElement();
+ final Document document = implementation.createDocument("axsl-font-config", null, docType);
+
+ final Element rootElement = document.getDocumentElement();
String lastFamily = null;
Element lastFamilyElement = null;
for (int i = 0; i < this.fontFiles.size(); i++) {
@@ -128,23 +138,23 @@
final String fontFamily = configFile.getFamilyName();
if (lastFamily == null
|| ! lastFamily.equals(fontFamily)) {
- lastFamilyElement = doc.createElement("font-family");
+ lastFamilyElement = document.createElement("font-family");
lastFamilyElement.setAttribute("name", configFile.getFamilyName());
rootElement.appendChild(lastFamilyElement);
}
lastFamily = fontFamily;
- final Element memberElement = doc.createElement("family-member");
+ final Element memberElement = document.createElement("family-member");
final Font.Style style = configFile.getStyle();
memberElement.setAttribute("style", style.getFoValue());
final Font.Weight weight = configFile.getWeight();
memberElement.setAttribute("weight", weight.getFoValue());
lastFamilyElement.appendChild(memberElement);
- final Element fontElement = doc.createElement("font");
+ final Element fontElement = document.createElement("font");
fontElement.setAttribute("id", configFile.getPostScriptName());
fontElement.setAttribute("font-file", configFile.getFontUrl());
memberElement.appendChild(fontElement);
}
- return doc;
+ return document;
}
/**
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-01-12 21:14:24 UTC (rev 11769)
+++ trunk/foray/master/build.gradle 2021-01-12 21:35:28 UTC (rev 11770)
@@ -29,7 +29,7 @@
group = 'org.foray'
version = '0.4-SNAPSHOT'
- /******************** See Notes below for information about dependency releases. ********************/
+ /******************** See Note 1 below for information about dependency releases. ********************/
ext.javaSourceCompatibility = JavaVersion.VERSION_1_7
ext.javaTargetCompatibility = JavaVersion.VERSION_1_7
@@ -41,7 +41,6 @@
ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12
ext.antVersion = '1.9.15' // Latest is 1.10.9 as of 2021-01-12 See Note 2.
ext.servletApiVersion = '3.1.0' // Latest is 4.0.1 as of 2021-01-12 See Note 3.
- ext.xercesImplVersion = '2.8.1' // Latest is 2.12.1 as of 2021-01-12 See Note 7.
ext.xmlResolverVersion = '1.2' // Latest is 1.2 as of 2021-01-12
ext.xmlgraphicsCommonsVersion = '1.4' // Latest is 2.4 as of 2021-01-12
ext.batikVersion = '1.6' // Latest is 1.13 as of 2021-01-12 See Note 4.
@@ -49,7 +48,7 @@
ext.icu4jVersion = '68.2' // Latest is 68.2 as of 2021-01-12
ext.junitVersion = '4.13.1' // Latest is 4.13.1 as of 2021-01-12
- ext.mockitoVersion = '2.25.1'
+ ext.mockitoVersion = '2.25.1' // Latest is 3.7.0 as of 2021-01-12
ext.logbackClassicVersion = '1.2.3' // Latest is 1.2.3 as of 2021-01-12
ext.checkstyleVersion = '8.39' // Latest is 8.39 as of 2021-01-12
@@ -77,12 +76,6 @@
* 6. Apache Commons IO releases, starting at 2.7, are compiled with Java 1.8 (major version 52), which produces
* compile-time warnings when we try to build with Java 1.7.
* We have therefore stayed with the highest version that supports the Java 1.7 compiler, which is 2.6.
- *
- * 7. The dependency on Xerces can probably be removed when we go to Java 9.
- *
- * 8. Starting with Xerxes 2.9.0, the XMLSerializer class is deprecated in favor of more standard serialization
- * code documented in the javadocs of XMLSerializer. For now, we choose to stay with the highest level still
- * supporting XMLSerializer, 2.8.1.
*/
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|