Author: nbelaevski
Date: 2008-01-08 12:49:04 -0500 (Tue, 08 Jan 2008)
New Revision: 5191
Modified:
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/css/CssCompressor.java
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java
branches/3.1.x/framework/impl/src/test/java/org/ajax4jsf/css/CssCompressorTest.java
Log:
http://jira.jboss.com/jira/browse/RF-1843
Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/css/CssCompressor.java
===================================================================
---
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/css/CssCompressor.java 2008-01-08
17:45:35 UTC (rev 5190)
+++
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/css/CssCompressor.java 2008-01-08
17:49:04 UTC (rev 5191)
@@ -15,6 +15,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.ajax4jsf.resource.CountingOutputWriter;
+
public class CssCompressor {
private StringBuffer srcsb = null;
@@ -146,7 +148,7 @@
// Trim the final string (for any leading or trailing white spaces)
css = css.trim();
- bytesLength = css.length() * 2;
+ bytesLength = css.length(); // * CountingOutputWriter.sizeOfChar;
// Write the output...
out.write(css);
return bytesLength;
Modified:
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java
===================================================================
---
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java 2008-01-08
17:45:35 UTC (rev 5190)
+++
branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/CountingOutputWriter.java 2008-01-08
17:49:04 UTC (rev 5191)
@@ -20,10 +20,10 @@
private int written = 0;
/** Size of char type */
- private static final int sizeOfChar = 2;
+ public static final int sizeOfChar = 1;
/** Size of int type */
- private static final int sizeOfInt = 4;
+ public static final int sizeOfInt = 2;
/** Buffer to store bytes written */
private StringBuffer buffer;
@@ -32,6 +32,7 @@
* Default constructor
*/
public CountingOutputWriter() {
+
super();
this.buffer = new StringBuffer();
}
@@ -57,7 +58,7 @@
*/
public void write(char[] cbuf, int off, int len) throws IOException {
buffer.append(cbuf, off, len);
- written += len * sizeOfChar;
+ written += len; // * sizeOfChar;
}
/** Methods appends chars written to buffer
@@ -65,7 +66,7 @@
*/
public void write(char[] cbuf) throws IOException {
buffer.append(cbuf);
- written += cbuf.length * sizeOfChar;
+ written += cbuf.length; // * sizeOfChar;
}
/** Methods appends int written to buffer
@@ -83,7 +84,7 @@
*/
public void write(String str, int off, int len) throws IOException {
buffer.append(str, off, len);
- written += len * sizeOfChar;
+ written += len;// * sizeOfChar;
}
/** Methods appends string written to buffer
@@ -91,7 +92,7 @@
*/
public void write(String str) throws IOException {
buffer.append(str);
- written += str.length() * sizeOfChar;
+ written += str.length();// * sizeOfChar;
}
/** Methods gets written bytes count
Modified:
branches/3.1.x/framework/impl/src/test/java/org/ajax4jsf/css/CssCompressorTest.java
===================================================================
---
branches/3.1.x/framework/impl/src/test/java/org/ajax4jsf/css/CssCompressorTest.java 2008-01-08
17:45:35 UTC (rev 5190)
+++
branches/3.1.x/framework/impl/src/test/java/org/ajax4jsf/css/CssCompressorTest.java 2008-01-08
17:49:04 UTC (rev 5191)
@@ -20,7 +20,7 @@
public class CssCompressorTest extends TestCase {
/** Length of correctly compressed css example */
- private static final int lengthCompressed = 610;
+ private static final int lengthCompressed = 305;
/** css example to be comressed */
private static final String cssExample =