Java Doc for LineBufferedReader.java in  » Scripting » Nice » gnu » text » 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 » Scripting » Nice » gnu.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.Reader
      java.io.FilterReader
         gnu.text.LineBufferedReader

All known Subclasses:   gnu.mapping.InPort,
LineBufferedReader
public class LineBufferedReader extends FilterReader (Code)
A LineNumberReader with some extra features: You can seek backwards to the start of the line preceding the current position (or the mark, if that has been set). You can use seek with a negative offset, or unread. You can also use peek to look at the next character without moving. The method getColumnNumber gives you the current column. Provides a method that is called at the start of a line. This is especially useful for interactive streams (e.g. prompting). It would be nice if we could inherit from LineNumberReader. That may be possible in theory, but it is difficult and expensive (because we don't get access to BufferedReader's buffer).
author:
   Per Bothner


Field Summary
final static  intBUFFER_SIZE
     Default (initial buffer) size.
public  char[]buffer
     The input buffer, containing the current line etc.
 inthighestPos
     The high-water mark for pos, at a reset or line start.
public  intlimit
     The length of the valid (data-containing) part of the buffer.
protected  intlineNumber
     The current line number (at position of lineStartPos).
 intlineStartPos
     The position that marks the start of the current or marked line. If the readAheadLimit && markPos < pos, then it is the start of the line containing the markPos. If we are at the end of a line, and have not started reading the next one (and are therefore allowed by unread back to the old line), the current line is still the old line; lineStartPos does not get set to the new pos until we read/peek the first char of the new line. If lineStartPos < 0, it means we went beyond the buffer maximum.
protected  intmarkPos
     The position of the mark (assuming readAheadLinit > 0). (Garbage if readAheadLimit <= 0).
 Stringname
    
public  intpos
     The current read position, as an index into buffer.
protected  intreadAheadLimit
     If mark has been called, and not invalidated, the read ahead limit. Zero if mark has not been called, or had been invalidated (due to either calling reset or excessive reading ahead).

Constructor Summary
public  LineBufferedReader(InputStream in)
    
public  LineBufferedReader(Reader in)
    

Method Summary
static  intcountLines(char[] buffer, int off, int len)
    
public  intfill(int len)
     Called by read() when it needs its buffer filled. Read characters into buffer, starting at off, for len. Can assume that len > 0.
public  intgetColumnNumber()
    
final public  booleangetConvertCR()
     True if CR and CRLF should be converted to LF.
public  intgetLineNumber()
     Get the current line number. The "first" line is number number 0.
public  StringgetName()
    
public  voidlineStart(boolean revisited)
     A hook to allow sub-classes to perform some action at start of line.
public synchronized  voidmark(int readAheadLimit)
    
public  booleanmarkSupported()
    
public  intpeek()
    
public  intread()
    
public  intread(char[] cbuf, int off, int len)
    
public  voidreadLine(StringBuffer sbuf, char mode)
     Read a line.
public  StringreadLine()
    
public  booleanready()
    
public  voidreset()
    
public  voidsetBuffer(char[] buffer)
     Specify a buffer to use for the input buffer.
final public  voidsetConvertCR(boolean convertCR)
    
public  voidsetLineNumber(int lineNumber)
    
public  voidsetName(String name)
    
public  intskip(int n)
     Skip forwards or backwards a number of characters.
public  voidskip()
    
final public  voidskip_quick()
     Same as skip(), but assumes previous command was a non-EOF peek().
public  voidunread()
    
public  voidunread_quick()
     Same as unread, but only allowed after non-EOF-returning read(). Also allowed after an intervening peek(), but only if the read() did not return '\r' or '\n'.

Field Detail
BUFFER_SIZE
final static int BUFFER_SIZE(Code)
Default (initial buffer) size.



buffer
public char[] buffer(Code)
The input buffer, containing the current line etc.



highestPos
int highestPos(Code)
The high-water mark for pos, at a reset or line start.



limit
public int limit(Code)
The length of the valid (data-containing) part of the buffer.



lineNumber
protected int lineNumber(Code)
The current line number (at position of lineStartPos).



lineStartPos
int lineStartPos(Code)
The position that marks the start of the current or marked line. If the readAheadLimit && markPos < pos, then it is the start of the line containing the markPos. If we are at the end of a line, and have not started reading the next one (and are therefore allowed by unread back to the old line), the current line is still the old line; lineStartPos does not get set to the new pos until we read/peek the first char of the new line. If lineStartPos < 0, it means we went beyond the buffer maximum.



markPos
protected int markPos(Code)
The position of the mark (assuming readAheadLinit > 0). (Garbage if readAheadLimit <= 0).



name
String name(Code)



pos
public int pos(Code)
The current read position, as an index into buffer.



readAheadLimit
protected int readAheadLimit(Code)
If mark has been called, and not invalidated, the read ahead limit. Zero if mark has not been called, or had been invalidated (due to either calling reset or excessive reading ahead).




Constructor Detail
LineBufferedReader
public LineBufferedReader(InputStream in)(Code)



LineBufferedReader
public LineBufferedReader(Reader in)(Code)




Method Detail
countLines
static int countLines(char[] buffer, int off, int len)(Code)



fill
public int fill(int len) throws java.io.IOException(Code)
Called by read() when it needs its buffer filled. Read characters into buffer, starting at off, for len. Can assume that len > 0. Only called if pos>=limit. Return -1 if EOF, otherwise number of read chars. This can be usefully overridden by sub-classes.



getColumnNumber
public int getColumnNumber()(Code)



getConvertCR
final public boolean getConvertCR()(Code)
True if CR and CRLF should be converted to LF.



getLineNumber
public int getLineNumber()(Code)
Get the current line number. The "first" line is number number 0.



getName
public String getName()(Code)



lineStart
public void lineStart(boolean revisited) throws java.io.IOException(Code)
A hook to allow sub-classes to perform some action at start of line. Called just before the first character of the new line is read.
Parameters:
  revisited - true if we have read here before (i.e.we did a reset of unread() to get here)



mark
public synchronized void mark(int readAheadLimit)(Code)



markSupported
public boolean markSupported()(Code)



peek
public int peek() throws java.io.IOException(Code)



read
public int read() throws java.io.IOException(Code)



read
public int read(char[] cbuf, int off, int len) throws java.io.IOException(Code)



readLine
public void readLine(StringBuffer sbuf, char mode) throws IOException(Code)
Read a line. If mode is 'I' ("ignore") ignore delimiters. If mode is 'P' ("peek") leave delimiter in input stream. If mode is 'A' ("append") append delimiter to result.



readLine
public String readLine() throws IOException(Code)



ready
public boolean ready() throws java.io.IOException(Code)



reset
public void reset() throws IOException(Code)



setBuffer
public void setBuffer(char[] buffer) throws java.io.IOException(Code)
Specify a buffer to use for the input buffer.



setConvertCR
final public void setConvertCR(boolean convertCR)(Code)



setLineNumber
public void setLineNumber(int lineNumber)(Code)



setName
public void setName(String name)(Code)



skip
public int skip(int n) throws IOException(Code)
Skip forwards or backwards a number of characters.



skip
public void skip() throws java.io.IOException(Code)



skip_quick
final public void skip_quick() throws java.io.IOException(Code)
Same as skip(), but assumes previous command was a non-EOF peek().



unread
public void unread() throws java.io.IOException(Code)



unread_quick
public void unread_quick()(Code)
Same as unread, but only allowed after non-EOF-returning read(). Also allowed after an intervening peek(), but only if the read() did not return '\r' or '\n'.



Fields inherited from java.io.FilterReader
protected Reader in(Code)(Java Doc)

Methods inherited from java.io.FilterReader
public void close() throws IOException(Code)(Java Doc)
public void mark(int readAheadLimit) throws IOException(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
public int read() throws IOException(Code)(Java Doc)
public int read(char cbuf, int off, int len) throws IOException(Code)(Java Doc)
public boolean ready() throws IOException(Code)(Java Doc)
public void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

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

Methods inherited from java.io.Reader
abstract public void close() throws IOException(Code)(Java Doc)
public void mark(int readAheadLimit) throws IOException(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
public int read(java.nio.CharBuffer target) throws IOException(Code)(Java Doc)
public int read() throws IOException(Code)(Java Doc)
public int read(char cbuf) throws IOException(Code)(Java Doc)
abstract public int read(char cbuf, int off, int len) throws IOException(Code)(Java Doc)
public boolean ready() throws IOException(Code)(Java Doc)
public void reset() throws IOException(Code)(Java Doc)
public long skip(long n) 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.