You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2012/10/29 17:46:30 UTC
svn commit: r1403415 - in /sis/branches/JDK7/sis-utility/src:
main/java/org/apache/sis/io/ test/java/org/apache/sis/io/
Author: desruisseaux
Date: Mon Oct 29 16:46:29 2012
New Revision: 1403415
URL: http://svn.apache.org/viewvc?rev=1403415&view=rev
Log:
Renamed LineWrapFormatter as LineFormatter, since it now combines the work of other line-related formatters.
Added:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
- copied, changed from r1403413, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineWrapFormatter.java
Removed:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineWrapFormatter.java
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EndOfLineFormatterTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/ExpandedTabFormatterTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/IndentedLineFormatterTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineWrapFormatterTest.java
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java Mon Oct 29 16:46:29 2012
@@ -43,7 +43,7 @@ import static org.apache.sis.util.Charac
* {@section Flushing and closing the stream}
* Subclasses implement the {@link java.io.Flushable} interface only if they
* hold data in an internal buffer before to send them to the wrapped {@code Appendable}.
- * This is the case of {@link TableFormatter} and {@link LineWrapFormatter} for instance.
+ * This is the case of {@link TableFormatter} and {@link LineFormatter} for instance.
* For unconditionally flushing or closing an {@code Appendable} and its underlying stream,
* see {@link IO#flush(Appendable)} and {@link IO#close(Appendable)}.
*
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java Mon Oct 29 16:46:29 2012
@@ -111,7 +111,7 @@ public final class IO extends Static {
*
* <p>It may be necessary to invoke {@link #flush(Appendable)} before this method in order
* to get proper content. In particular, this is necessary if the chain of {@code Appendable}s
- * contains {@link TableFormatter} or {@link LineWrapFormatter} instances.</p>
+ * contains {@link TableFormatter} or {@link LineFormatter} instances.</p>
*
* @param out The stream or buffer from which to get the content, or {@code null}.
* @return The content of the given stream of buffer, or {@code null} if unavailable.
Copied: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java (from r1403413, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineWrapFormatter.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineWrapFormatter.java&r1=1403413&r2=1403415&rev=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineWrapFormatter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java Mon Oct 29 16:46:29 2012
@@ -63,7 +63,7 @@ import org.apache.sis.util.ArgumentCheck
* @module
*/
@Decorator(Appendable.class)
-public class LineWrapFormatter extends FilteredAppendable implements Flushable {
+public class LineFormatter extends FilteredAppendable implements Flushable {
/**
* The line separator, or {@code null} if not yet determined. If {@code null}, then the
* {@link #append(CharSequence, int, int)} method will try to infer it from the submitted text.
@@ -160,7 +160,7 @@ public class LineWrapFormatter extends F
*
* @param out The underlying stream or buffer to write to.
*/
- public LineWrapFormatter(final Appendable out) {
+ public LineFormatter(final Appendable out) {
super(out);
maximalLineLength = Integer.MAX_VALUE;
}
@@ -174,7 +174,7 @@ public class LineWrapFormatter extends F
* @param isTabulationExpanded {@code true} for expanding tabulations into spaces,
* or {@code false} for sending {@code '\t'} characters as-is.
*/
- public LineWrapFormatter(final Appendable out, final String lineSeparator, final boolean isTabulationExpanded) {
+ public LineFormatter(final Appendable out, final String lineSeparator, final boolean isTabulationExpanded) {
super(out);
maximalLineLength = Integer.MAX_VALUE;
this.lineSeparator = lineSeparator;
@@ -191,7 +191,7 @@ public class LineWrapFormatter extends F
* @param isTabulationExpanded {@code true} for expanding tabulations into spaces,
* or {@code false} for forwarding {@code '\t'} characters as-is.
*/
- public LineWrapFormatter(final Appendable out, final int maximalLineLength, final boolean isTabulationExpanded) {
+ public LineFormatter(final Appendable out, final int maximalLineLength, final boolean isTabulationExpanded) {
super(out);
ArgumentChecks.ensureStrictlyPositive("maximalLineLength", maximalLineLength);
this.maximalLineLength = maximalLineLength;
@@ -519,7 +519,7 @@ searchHyp: for (int i=buffer.length();
/**
* Sends pending characters to the underlying stream. Note that this method should
* preferably be invoked at the end of a word, sentence or line, since invoking it
- * may prevent {@code LineWrapFormatter} to properly wrap the current line if it is
+ * may prevent {@code LineFormatter} to properly wrap the current line if it is
* in the middle of a word.
*
* <p>Invoking this method also flushes the {@linkplain #out underlying stream}.
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java Mon Oct 29 16:46:29 2012
@@ -801,7 +801,7 @@ public class TableFormatter extends Filt
out.append(leftBorder);
}
final Appendable tabExpander = (cellText.indexOf('\t') >= 0)
- ? new LineWrapFormatter(out, Integer.MAX_VALUE, true) : out;
+ ? new LineFormatter(out, Integer.MAX_VALUE, true) : out;
switch (cell.alignment) {
default: {
throw new AssertionError(cell.alignment);
Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EndOfLineFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EndOfLineFormatterTest.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EndOfLineFormatterTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EndOfLineFormatterTest.java Mon Oct 29 16:46:29 2012
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link LineWrapFormatter} implementation
+ * Tests the {@link LineFormatter} implementation
* when used for changing the line separator.
*
* @author Martin Desruisseaux (Geomatys)
@@ -38,7 +38,7 @@ public final strictfp class EndOfLineFor
* Creates a new test case.
*/
public EndOfLineFormatterTest() {
- formatter = new LineWrapFormatter(formatter, " ", false);
+ formatter = new LineFormatter(formatter, " ", false);
}
/**
@@ -47,8 +47,8 @@ public final strictfp class EndOfLineFor
@Override
void run(final String lineSeparator) throws IOException {
final Appendable out = formatter;
- if (out instanceof LineWrapFormatter) {
- assertEquals("getLineSeparator", " ", ((LineWrapFormatter) out).getLineSeparator());
+ if (out instanceof LineFormatter) {
+ assertEquals("getLineSeparator", " ", ((LineFormatter) out).getLineSeparator());
}
assertSame(out, out.append("Le vrai" + lineSeparator + "policitien, "));
assertSame(out, out.append("c'est celui\r\nqui\r")); // Line separator broken on two method calls.
Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/ExpandedTabFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/ExpandedTabFormatterTest.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/ExpandedTabFormatterTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/ExpandedTabFormatterTest.java Mon Oct 29 16:46:29 2012
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link LineWrapFormatter} implementation
+ * Tests the {@link LineFormatter} implementation
* when used for expanding tabulations to spaces.
*
* @author Martin Desruisseaux (Geomatys)
@@ -38,7 +38,7 @@ public final strictfp class ExpandedTabF
* Creates a new test case.
*/
public ExpandedTabFormatterTest() {
- formatter = new LineWrapFormatter(formatter, null, true);
+ formatter = new LineFormatter(formatter, null, true);
}
/**
@@ -47,8 +47,8 @@ public final strictfp class ExpandedTabF
@Override
void run(final String lineSeparator) throws IOException {
final Appendable out = formatter;
- if (out instanceof LineWrapFormatter) {
- assertEquals("getTabWidth", 8, ((LineWrapFormatter) out).getTabulationWidth());
+ if (out instanceof LineFormatter) {
+ assertEquals("getTabWidth", 8, ((LineFormatter) out).getTabulationWidth());
}
assertSame(out, out.append("12\t8" + lineSeparator));
assertSame(out, out.append("1234\t8" + lineSeparator));
Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/IndentedLineFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/IndentedLineFormatterTest.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/IndentedLineFormatterTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/IndentedLineFormatterTest.java Mon Oct 29 16:46:29 2012
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link LineWrapFormatter} implementation
+ * Tests the {@link LineFormatter} implementation
* when used for inserting a margin before every line.
*
* @author Martin Desruisseaux (Geomatys)
@@ -38,7 +38,7 @@ public final strictfp class IndentedLine
* Creates a new test case.
*/
public IndentedLineFormatterTest() {
- formatter = new LineWrapFormatter(formatter) {
+ formatter = new LineFormatter(formatter) {
@Override
protected void onLineBegin(boolean isContinuation) throws IOException {
out.append(" ");
Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineWrapFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineWrapFormatterTest.java?rev=1403415&r1=1403414&r2=1403415&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineWrapFormatterTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineWrapFormatterTest.java Mon Oct 29 16:46:29 2012
@@ -25,7 +25,7 @@ import static org.apache.sis.util.Charac
/**
- * Tests the {@link LineWrapFormatter} implementation
+ * Tests the {@link LineFormatter} implementation
* when used for wrapping lines to 80 characters.
*
* @author Martin Desruisseaux (Geomatys)
@@ -39,7 +39,7 @@ public final strictfp class LineWrapForm
* Creates a new test case.
*/
public LineWrapFormatterTest() {
- formatter = new LineWrapFormatter(formatter, 10, false);
+ formatter = new LineFormatter(formatter, 10, false);
}
/**
@@ -48,8 +48,8 @@ public final strictfp class LineWrapForm
@Override
void run(final String lineSeparator) throws IOException {
final Appendable out = formatter;
- if (out instanceof LineWrapFormatter) {
- assertEquals("getMaximalLineLength", 10, ((LineWrapFormatter) out).getMaximalLineLength());
+ if (out instanceof LineFormatter) {
+ assertEquals("getMaximalLineLength", 10, ((LineFormatter) out).getMaximalLineLength());
}
final String BLUE = X364.FOREGROUND_BLUE .sequence();
final String DEFAULT = X364.FOREGROUND_DEFAULT.sequence();
@@ -60,7 +60,7 @@ public final strictfp class LineWrapForm
assertSame(out, out.append("Ma vitre est un jar" + SOFT_HYPHEN + "din de givre." + lineSeparator));
/*
* If our test case is using the wrapper which will send the data once character at time,
- * our LineWrapFormatter implementation will not be able to detect the line separator and
+ * our LineFormatter implementation will not be able to detect the line separator and
* will fallback on the default one. So we set the line separator to the one actually used
* not because this is the class contract (quite the opposite, this is a limitation in our
* implementation), but simply in order to allow the test to pass.