Java Doc for BMByteSearchStream.java in  » J2EE » Enhydra-Application-Framework » com » lutris » util » 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 » J2EE » Enhydra Application Framework » com.lutris.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      java.io.FilterInputStream
         com.lutris.util.BMByteSearchStream

BMByteSearchStream
public class BMByteSearchStream extends FilterInputStream (Code)
Implements the Boyer-Moore pattern matching algorithm for a given byte pattern. This object implements searches on byte-oriented input streams.

The algorithm was obtained from "Computer Algorithms - Introduction to Design and Analysis, Second Edition" by Sara Baase.



Field Summary
final public static  intAT_PATTERN
     "At Pattern" value.
final public static  intEOF
     EOF value.

Constructor Summary
public  BMByteSearchStream(InputStream inputSource, String pattern, int buflen)
     Creates a Boyer-Moore byte stream scanner for a given pattern. Creates a buffer of length buflen for the scanning buffer.
Parameters:
  inputSource - The input source stream to scan.
Parameters:
  pattern - The pattern to scan for.

Method Summary
public  intavailable()
     Returns the number of bytes that can be read from this input stream without blocking.
public  intavailableTo()
     Returns the number of bytes that can be read from this input stream without blocking or encountering the search pattern.
public  StringpeekAheadString(int length)
     Returns the next length bytes of the input buffer as a string.
public  intread()
     Reads the next byte of data from this input stream.
public  intread(byte[] buffer)
     Reads up to buffer.length bytes of data from this input stream into an array of bytes.
public  intread(byte[] buffer, int offset, int length)
     Reads length bytes of data from this input stream into an array of bytes.
public  intreadTo(byte[] buffer, int offset, int length)
     Reads data into a buffer until the search pattern or the end of file is detected.
public  voidsetPattern(String pattern)
     Set the search pattern.
public  voidsetPattern(BMByteSearch search)
     Set the search pattern.
public  longskip(long n)
     Skips over and discards n bytes of data from the input stream.
public  intskipPattern()
     Skips all bytes up to and including the search pattern or EOF.
public  intskipTo()
     Skips all bytes up to but not including the search pattern or EOF. Returns the number of bytes skipped.

Field Detail
AT_PATTERN
final public static int AT_PATTERN(Code)
"At Pattern" value. Indicates that the stream position is currently at the beginning of a detected pattern occurence.



EOF
final public static int EOF(Code)
EOF value. Traditionally -1.




Constructor Detail
BMByteSearchStream
public BMByteSearchStream(InputStream inputSource, String pattern, int buflen)(Code)
Creates a Boyer-Moore byte stream scanner for a given pattern. Creates a buffer of length buflen for the scanning buffer.
Parameters:
  inputSource - The input source stream to scan.
Parameters:
  pattern - The pattern to scan for. Charactersoutside the Latin-1 encoding are truncatedto signed bytes.
Parameters:
  buflen - The length to use for the scanning buffer.




Method Detail
available
public int available() throws IOException(Code)
Returns the number of bytes that can be read from this input stream without blocking. This consists of any bytes left in the buffer plus the result of the underlying stream's available method. The number of bytes that can be readwithout blocking.
exception:
  IOException - If an I/O error occurs.



availableTo
public int availableTo() throws IOException(Code)
Returns the number of bytes that can be read from this input stream without blocking or encountering the search pattern. If the search pattern has been found in the buffer, this is the number of bytes in the search buffer prior to the search pattern; otherwise, while there may be additional data in the input stream buffer that can be brought into the search buffer without blocking, this data may or may not contain the search pattern (or complete a partial search pattern located at the end of the buffer), so this is calculated as the number of bytes left in the search buffer less the length of the search pattern. The number of bytes that can be readfor certain without blocking or encounteringthe search pattern.
exception:
  IOException - If an I/O error occurs.



peekAheadString
public String peekAheadString(int length) throws IOException(Code)
Returns the next length bytes of the input buffer as a string. If fewer than length bytes remain on the input stream, then only the remaining bytes are returned. If the input stream is at EOF and there are no more bytes in the buffer then an empty string is returned.
Parameters:
  length - The number of bytes to look ahead. A string containing the lookahead bytes as 8 bit characters.
exception:
  IOException - Thrown if an I/O exception occurs.



read
public int read() throws IOException(Code)
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown The next byte of data, or -1 if the end of stream is reached.
exception:
  IOException - If an I/O error occurs.



read
public int read(byte[] buffer) throws IOException(Code)
Reads up to buffer.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available
Parameters:
  buffer - The buffer into which data are read. The number of bytes actually read, or -1if there are no more bytes because theend of stream has been reached.
exception:
  IOException - If an I/O error occurs.



read
public int read(byte[] buffer, int offset, int length) throws IOException(Code)
Reads length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.
Parameters:
  buffer - The buffer into which data are read.
Parameters:
  offset - The start offset of the data.
Parameters:
  length - The maximum number of bytes read. The total number of bytes read into the buffer, or -1 if there are no more bytesbecause the end of stream has been reached.
exception:
  IOException - If an I/O error occurs.



readTo
public int readTo(byte[] buffer, int offset, int length) throws IOException(Code)
Reads data into a buffer until the search pattern or the end of file is detected. Returns -1 if at the search pattern or end-of-file.
Parameters:
  buffer - Buffer to read into.
Parameters:
  offset - Offset in buffer to read into.
Parameters:
  length - Number of bytes to try to read. The number of bytes actually read, or-1 if at the pattern or eof.
exception:
  IOException - Thrown if an I/O exception occurs.



setPattern
public void setPattern(String pattern)(Code)
Set the search pattern. After this call, all new scans will be for the new pattern. Characters outside the values 0-255 are truncated into signed byte values in the Latin-1 encoding.
Parameters:
  pattern - The new pattern to search for.



setPattern
public void setPattern(BMByteSearch search)(Code)
Set the search pattern. After this call, all new scans will be for the new pattern. Characters outside the values 0-255 are truncated into signed byte values in the Latin-1 encoding.
Parameters:
  search - The precomputed Boyer-Moore searcher.



skip
public long skip(long n) throws IOException(Code)
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.
Parameters:
  n - The number of bytes to be skipped. The actual number of bytes skipped.
exception:
  IOException - If an I/O error occurs.



skipPattern
public int skipPattern() throws IOException(Code)
Skips all bytes up to and including the search pattern or EOF. The number of bytes skipped.
exception:
  IOException - Thrown if an I/O exception occurs.



skipTo
public int skipTo() throws IOException(Code)
Skips all bytes up to but not including the search pattern or EOF. Returns the number of bytes skipped. Repeated calls to this method will leave the stream at the same postion until another call explicitly reads or skips the pattern data. The number of bytes skipped.
exception:
  IOException - Thrown if an I/O exception occurs.



Fields inherited from java.io.FilterInputStream
protected volatile InputStream in(Code)(Java Doc)

Methods inherited from java.io.FilterInputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
abstract public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized 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.