Java Doc for TableWriter.java in  » GIS » GeoTools-2.4.1 » org » geotools » io » 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 » GIS » GeoTools 2.4.1 » org.geotools.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.Writer
      java.io.FilterWriter
         org.geotools.io.TableWriter

TableWriter
public class TableWriter extends FilterWriter (Code)
A character stream that can be used to format tables. Columns are separated by tabulations ('\t') and rows are separated by line terminators ('\r', '\n' or "\r\n"). Every table's cells are stored in memory until TableWriter.flush() is invoked. When invoked, TableWriter.flush() copy cell's contents to the underlying stream while replacing tabulations by some amount of spaces. The exact number of spaces is computed from cell's widths. TableWriter produces correct output when displayed with a monospace font.

For example, the following code...
 TableWriter out = new TableWriter(new OutputStreamWriter(System.out), 3);
 out.write("Prénom\tNom\n");
 out.nextLine('-');
 out.write("Idéphonse\tLaporte\nSarah\tCoursi\nYvan\tDubois");
 out.flush();
 
...produces the following output:
 Prénom      Nom
 ---------   -------
 Idéphonse   Laporte
 Sarah       Coursi
 Yvan        Dubois
 

since:
   2.0
version:
   $Id: TableWriter.java 22691 2006-11-10 22:30:28Z desruisseaux $
author:
   Martin Desruisseaux


Field Summary
final public static  intALIGN_CENTER
     A possible value for cell alignment.
final public static  intALIGN_LEFT
     A possible value for cell alignment.
final public static  intALIGN_RIGHT
     A possible value for cell alignment.

Constructor Summary
public  TableWriter(Writer out)
     Creates a new table writer with a default column separator.
public  TableWriter(Writer out, int spaces)
     Creates a new table writer with the specified amount of spaces as column separator.
public  TableWriter(Writer out, String separator)
     Creates a new table writer with the specified column separator.
Parameters:
  out - Writer object to provide the underlying stream,or null if there is no underlying stream.If out is null, then the TableWriter.toStringmethod is the only way to get the table's content.
Parameters:
  separator - String to write between columns.

Method Summary
public  voidclose()
     Flush the table content and close the underlying stream.
public  voidflush()
     Flush the table content to the underlying stream.
public  intgetAlignment()
     Returns the alignment for current and next cells.
public  booleanisMultiLinesCells()
     Tells if EOL characters are used for line feeds inside current cells.
public  voidnextColumn()
     Moves one column to the right.
public  voidnextColumn(char fill)
     Moves one column to the right.
public  voidnextLine()
     Moves to the first column on the next row.
public  voidnextLine(char fill)
     Moves to the first column on the next row.
public  voidsetAlignment(int alignment)
     Set the alignment for current and next cells.
public  voidsetColumnAlignment(int column, int alignment)
     Set the alignment for all cells in the specified column.
public  voidsetMultiLinesCells(boolean multiLines)
     Set the desired behavior for EOL and tabulations characters.
  • If true , EOL ('\r', '\n' or "\r\n") and tabulations ('\t') characters are copied straight into the current cell, which mean that next write operations will continue inside the same cell.
  • If false , then tabulations move to next column and EOL move to the first cell of next row (i.e.
public  StringtoString()
     Returns the table content as a string.
public  voidwrite(int c)
     Write a single character.
public  voidwrite(String string)
     Write a string.
public  voidwrite(String string, int offset, int length)
     Write a portion of a string.
public  voidwrite(char cbuf)
     Write an array of characters.
public  voidwrite(char cbuf, int offset, int length)
     Write a portion of an array of characters.
public  voidwriteHorizontalSeparator()
     Write an horizontal separator.

Field Detail
ALIGN_CENTER
final public static int ALIGN_CENTER(Code)
A possible value for cell alignment. This specifies that the text is aligned to the center and extra whitespace should be placed equally on the left and right.



ALIGN_LEFT
final public static int ALIGN_LEFT(Code)
A possible value for cell alignment. This specifies that the text is aligned to the left indent and extra whitespace should be placed on the right.



ALIGN_RIGHT
final public static int ALIGN_RIGHT(Code)
A possible value for cell alignment. This specifies that the text is aligned to the right indent and extra whitespace should be placed on the left.




Constructor Detail
TableWriter
public TableWriter(Writer out)(Code)
Creates a new table writer with a default column separator. Note: this writer may produces bad output on Windows console, unless the underlying stream use the correct codepage (e.g. OutputStreamWriter(System.out, "Cp437")). To display the appropriate codepage for a Windows NT console, type chcp on the command line.
Parameters:
  out - Writer object to provide the underlying stream,or null if there is no underlying stream.If out is null, then the TableWriter.toStringmethod is the only way to get the table's content.



TableWriter
public TableWriter(Writer out, int spaces)(Code)
Creates a new table writer with the specified amount of spaces as column separator.
Parameters:
  out - Writer object to provide the underlying stream,or null if there is no underlying stream.If out is null, then the TableWriter.toStringmethod is the only way to get the table's content.
Parameters:
  spaces - Amount of white spaces to use as column separator.



TableWriter
public TableWriter(Writer out, String separator)(Code)
Creates a new table writer with the specified column separator.
Parameters:
  out - Writer object to provide the underlying stream,or null if there is no underlying stream.If out is null, then the TableWriter.toStringmethod is the only way to get the table's content.
Parameters:
  separator - String to write between columns. Drawing box charactersare treated specially. For example " \\u2502 " can beused for a single-line box.




Method Detail
close
public void close() throws IOException(Code)
Flush the table content and close the underlying stream.
throws:
  IOException - if an output operation failed.



flush
public void flush() throws IOException(Code)
Flush the table content to the underlying stream. This method should not be called before the table is completed (otherwise, columns may have the wrong width).
throws:
  IOException - if an output operation failed.



getAlignment
public int getAlignment()(Code)
Returns the alignment for current and next cells. Cell alignment: TableWriter.ALIGN_LEFT (the default),TableWriter.ALIGN_RIGHT or TableWriter.ALIGN_CENTER.



isMultiLinesCells
public boolean isMultiLinesCells()(Code)
Tells if EOL characters are used for line feeds inside current cells.



nextColumn
public void nextColumn()(Code)
Moves one column to the right. Next write operations will occur in a new cell on the same row.



nextColumn
public void nextColumn(char fill)(Code)
Moves one column to the right. Next write operations will occur in a new cell on the same row. This method fill every remaining space in the current cell with the specified character. For example calling nextColumn('*') from the first character of a cell is a convenient way to put a pad value in this cell.
Parameters:
  fill - Character filling the cell (default to whitespace).



nextLine
public void nextLine()(Code)
Moves to the first column on the next row. Next write operations will occur on a new row.



nextLine
public void nextLine(char fill)(Code)
Moves to the first column on the next row. Next write operations will occur on a new row. This method fill every remaining cell in the current row with the specified character. Calling nextLine('-') from the first column of a row is a convenient way to fill this row with a line separator.
Parameters:
  fill - Character filling the rest of the line(default to whitespace). This caracter maybe use as a row separator.



setAlignment
public void setAlignment(int alignment)(Code)
Set the alignment for current and next cells. Change to the alignment doesn't affect the alignment of previous cells and previous rows. The default alignment is TableWriter.ALIGN_LEFT .
Parameters:
  alignment - Cell alignment. Must be TableWriter.ALIGN_LEFTTableWriter.ALIGN_RIGHT or TableWriter.ALIGN_CENTER.



setColumnAlignment
public void setColumnAlignment(int column, int alignment)(Code)
Set the alignment for all cells in the specified column. This method overwrite the alignment for all previous cells in the specified column.
Parameters:
  column - The 0-based column number.
Parameters:
  alignment - Cell alignment. Must be TableWriter.ALIGN_LEFTTableWriter.ALIGN_RIGHT or TableWriter.ALIGN_CENTER.



setMultiLinesCells
public void setMultiLinesCells(boolean multiLines)(Code)
Set the desired behavior for EOL and tabulations characters.
  • If true , EOL ('\r', '\n' or "\r\n") and tabulations ('\t') characters are copied straight into the current cell, which mean that next write operations will continue inside the same cell.
  • If false , then tabulations move to next column and EOL move to the first cell of next row (i.e. tabulation and EOL are equivalent to TableWriter.nextColumn() and TableWriter.nextLine() calls respectively).
The default value is false .
Parameters:
  multiLines - true true if EOL are used for line feeds insidecurrent cells, or false if EOL move to the next row.



toString
public String toString()(Code)
Returns the table content as a string.



write
public void write(int c)(Code)
Write a single character. If TableWriter.isMultiLinesCells() is false (which is the default), then:
Parameters:
  c - Character to write.



write
public void write(String string)(Code)
Write a string. Tabulations and line separators are interpreted as by TableWriter.write(int) .
Parameters:
  string - String to write.



write
public void write(String string, int offset, int length)(Code)
Write a portion of a string. Tabulations and line separators are interpreted as by TableWriter.write(int) .
Parameters:
  string - String to write.
Parameters:
  offset - Offset from which to start writing characters.
Parameters:
  length - Number of characters to write.



write
public void write(char cbuf)(Code)
Write an array of characters. Tabulations and line separators are interpreted as by TableWriter.write(int) .
Parameters:
  cbuf - Array of characters to be written.



write
public void write(char cbuf, int offset, int length)(Code)
Write a portion of an array of characters. Tabulations and line separators are interpreted as by TableWriter.write(int) .
Parameters:
  cbuf - Array of characters.
Parameters:
  offset - Offset from which to start writing characters.
Parameters:
  length - Number of characters to write.



writeHorizontalSeparator
public void writeHorizontalSeparator()(Code)
Write an horizontal separator.



Fields inherited from java.io.FilterWriter
protected Writer out(Code)(Java Doc)

Methods inherited from java.io.FilterWriter
public void close() throws IOException(Code)(Java Doc)
public void flush() throws IOException(Code)(Java Doc)
public void write(int c) throws IOException(Code)(Java Doc)
public void write(char cbuf, int off, int len) throws IOException(Code)(Java Doc)
public void write(String str, int off, int len) throws IOException(Code)(Java Doc)

Fields inherited from java.io.Writer
protected Object lock(Code)(Java Doc)

Methods inherited from java.io.Writer
public Writer append(CharSequence csq) throws IOException(Code)(Java Doc)
public Writer append(CharSequence csq, int start, int end) throws IOException(Code)(Java Doc)
public Writer append(char c) throws IOException(Code)(Java Doc)
abstract public void close() throws IOException(Code)(Java Doc)
abstract public void flush() throws IOException(Code)(Java Doc)
public void write(int c) throws IOException(Code)(Java Doc)
public void write(char cbuf) throws IOException(Code)(Java Doc)
abstract public void write(char cbuf, int off, int len) throws IOException(Code)(Java Doc)
public void write(String str) throws IOException(Code)(Java Doc)
public void write(String str, int off, int len) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.