Java Doc for FixCrLfFilter.java in  » Build » ANT » org » apache » tools » ant » filters » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.filters 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.tools.ant.filters.BaseFilterReader
   org.apache.tools.ant.filters.BaseParamFilterReader
      org.apache.tools.ant.filters.FixCrLfFilter

FixCrLfFilter
final public class FixCrLfFilter extends BaseParamFilterReader implements ChainableReader(Code)
Converts text to local OS formatting conventions, as well as repair text damaged by misconfigured or misguided editors or file transfer programs.

This filter can take the following arguments:

  • eof
  • eol
  • fixlast
  • javafiles
  • tab
  • tablength
None of which are required.

This version generalises the handling of EOL characters, and allows for CR-only line endings (the standard on Mac systems prior to OS X). Tab handling has also been generalised to accommodate any tabwidth from 2 to 80, inclusive. Importantly, it can leave untouched any literal TAB characters embedded within Java string or character constants.

Caution: run with care on carefully formatted files. This may sound obvious, but if you don't specify asis, presume that your files are going to be modified. If "tabs" is "add" or "remove", whitespace characters may be added or removed as necessary. Similarly, for EOLs, eol="asis" actually means convert to your native O/S EOL convention while eol="crlf" or cr="add" can result in CR characters being removed in one special case accommodated, i.e., CRCRLF is regarded as a single EOL to handle cases where other programs have converted CRLF into CRCRLF.

Example:

 <<fixcrlf tab="add" eol="crlf" eof="asis"/>
 
Or:
 <filterreader classname="org.apache.tools.ant.filters.FixCrLfFilter">
 <param eol="crlf" tab="asis"/>
 </filterreader>
 

Inner Class :public static class AddAsisRemove extends EnumeratedAttribute
Inner Class :public static class CrLf extends EnumeratedAttribute


Constructor Summary
public  FixCrLfFilter()
     Constructor for "dummy" instances.
public  FixCrLfFilter(Reader in)
     Create a new filtered reader.
Parameters:
  in - A Reader object providing the underlying stream.

Method Summary
public  Readerchain(Reader rdr)
     Create a new FixCrLfFilter using the passed in Reader for instantiation.
Parameters:
  rdr - A Reader object providing the underlying stream.
public  AddAsisRemovegetEof()
     Get how DOS EOF (control-z) characters are being handled.
public  CrLfgetEol()
     Get how EndOfLine characters are being handled.
public  booleangetFixlast()
     Get whether a missing EOL be added to the final line of the stream.
public  booleangetJavafiles()
     Get whether the stream is to be treated as though it contains Java source.

This attribute is only used in assocation with the "tab" attribute.

public  AddAsisRemovegetTab()
     Return how tab characters are being handled.
public  intgetTablength()
     Get the tab length to use.
public synchronized  intread()
     Return the next character in the filtered stream.
public  voidsetEof(AddAsisRemove attr)
     Specify how DOS EOF (control-z) characters are to be handled.
public  voidsetEol(CrLf attr)
     Specify how end of line (EOL) characters are to be handled.
public  voidsetFixlast(boolean fixlast)
     Specify whether a missing EOL will be added to the final line of input.
public  voidsetJavafiles(boolean javafiles)
     Indicate whether this stream contains Java source.
public  voidsetTab(AddAsisRemove attr)
     Specify how tab characters are to be handled.
public  voidsetTablength(int tabLength)
     Specify tab length in characters.
Parameters:
  tabLength - specify the length of tab in spaces.


Constructor Detail
FixCrLfFilter
public FixCrLfFilter()(Code)
Constructor for "dummy" instances.
See Also:   BaseFilterReader.BaseFilterReader



FixCrLfFilter
public FixCrLfFilter(Reader in) throws IOException(Code)
Create a new filtered reader.
Parameters:
  in - A Reader object providing the underlying stream. Must not benull.
throws:
  IOException - on error.




Method Detail
chain
public Reader chain(Reader rdr)(Code)
Create a new FixCrLfFilter using the passed in Reader for instantiation.
Parameters:
  rdr - A Reader object providing the underlying stream. Must not benull. a new filter based on this configuration, but filtering thespecified reader.



getEof
public AddAsisRemove getEof()(Code)
Get how DOS EOF (control-z) characters are being handled. values:
  • add: ensure that there is an eof at the end of the file
  • asis: leave eof characters alone
  • remove: remove any eof character found at the end



getEol
public CrLf getEol()(Code)
Get how EndOfLine characters are being handled. values:
  • asis: convert line endings to your O/S convention
  • cr: convert line endings to CR
  • lf: convert line endings to LF
  • crlf: convert line endings to CRLF



getFixlast
public boolean getFixlast()(Code)
Get whether a missing EOL be added to the final line of the stream. true if a filtered file will always end with an EOL



getJavafiles
public boolean getJavafiles()(Code)
Get whether the stream is to be treated as though it contains Java source.

This attribute is only used in assocation with the "tab" attribute. Tabs found in Java literals are protected from changes by this filter. true if whitespace in Java character and string literals isignored.




getTab
public AddAsisRemove getTab()(Code)
Return how tab characters are being handled. values:
  • add: convert sequences of spaces which span a tab stop totabs
  • asis: leave tab and space characters alone
  • remove: convert tabs to spaces



getTablength
public int getTablength()(Code)
Get the tab length to use. the length of tab in spaces



read
public synchronized int read() throws IOException(Code)
Return the next character in the filtered stream. the next character in the resulting stream, or -1 if the end ofthe resulting stream has been reached.
exception:
  IOException - if the underlying stream throws an IOException duringreading.



setEof
public void setEof(AddAsisRemove attr)(Code)
Specify how DOS EOF (control-z) characters are to be handled.
Parameters:
  attr - valid values:
  • add: ensure that there is an eof at the end of the file
  • asis: leave eof characters alone
  • remove: remove any eof character found at the end



setEol
public void setEol(CrLf attr)(Code)
Specify how end of line (EOL) characters are to be handled.
Parameters:
  attr - valid values:
  • asis: convert line endings to your O/S convention
  • cr: convert line endings to CR
  • lf: convert line endings to LF
  • crlf: convert line endings to CRLF



setFixlast
public void setFixlast(boolean fixlast)(Code)
Specify whether a missing EOL will be added to the final line of input.
Parameters:
  fixlast - if true a missing EOL will be appended.



setJavafiles
public void setJavafiles(boolean javafiles)(Code)
Indicate whether this stream contains Java source. This attribute is only used in assocation with the "tab" attribute.
Parameters:
  javafiles - set to true to prevent this filter from changing tabs found inJava literals.



setTab
public void setTab(AddAsisRemove attr)(Code)
Specify how tab characters are to be handled.
Parameters:
  attr - valid values:
  • add: convert sequences of spaces which span a tab stop totabs
  • asis: leave tab and space characters alone
  • remove: convert tabs to spaces



setTablength
public void setTablength(int tabLength) throws IOException(Code)
Specify tab length in characters.
Parameters:
  tabLength - specify the length of tab in spaces. Valid values are between2 and 80 inclusive. The default for this parameter is 8.
throws:
  IOException - on error.



Methods inherited from org.apache.tools.ant.filters.BaseParamFilterReader
final protected Parameter[] getParameters()(Code)(Java Doc)
final public void setParameters(Parameter[] parameters)(Code)(Java Doc)

Methods inherited from org.apache.tools.ant.filters.BaseFilterReader
final protected boolean getInitialized()(Code)(Java Doc)
final protected Project getProject()(Code)(Java Doc)
final public int read(char[] cbuf, int off, int len) throws IOException(Code)(Java Doc)
final protected String readFully() throws IOException(Code)(Java Doc)
final protected String readLine() throws IOException(Code)(Java Doc)
final protected void setInitialized(boolean initialized)(Code)(Java Doc)
final public void setProject(Project project)(Code)(Java Doc)
final public long skip(long n) throws IOException, IllegalArgumentException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.