Java Doc for ByteArrayPushBackInputStream.java in  » PDF » PDFBox-0.7.3 » org » pdfbox » 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 » PDF » PDFBox 0.7.3 » org.pdfbox.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.io.PushbackInputStream
   org.pdfbox.io.PushBackInputStream
      org.pdfbox.io.ByteArrayPushBackInputStream

ByteArrayPushBackInputStream
public class ByteArrayPushBackInputStream extends PushBackInputStream (Code)
PushBackInputStream for byte arrays. The inheritance from PushBackInputStream is only to avoid the introduction of an interface with all PushBackInputStream methods. The parent PushBackInputStream is not used in any way and all methods are overridden. (Thus when adding new methods to PushBackInputStream override them in this class as well!) unread() is limited to the number of bytes already read from this stream (i.e. the current position in the array). This limitation usually poses no problem to a parser, but allows for some optimization since only one array has to be dealt with. Note: This class is not thread safe. Clients must provide synchronization if needed. Note: Calling unread() after mark() will cause (part of) the unread data to be read again after reset(). Thus do not call unread() between mark() and reset().
author:
   Andreas Weiss (andreas.weiss@switzerland.org)
version:
   $Revision: 1.2 $



Constructor Summary
public  ByteArrayPushBackInputStream(byte[] input)
     Constructor.
Parameters:
  input - Data to read from.

Method Summary
public  intavailable()
     Available bytes.
public  booleanisEOF()
     A simple test to see if we are at the end of the stream.
public  intlocalRead(byte[] buffer, int off, int len)
     Read a number of bytes.
public  voidmark(int readlimit)
     Save the state of this stream.
public  booleanmarkSupported()
     Check if mark is supported.
public  intpeek()
     This will peek at the next byte.
public  intread()
     Read a byte.
public  intread(byte[] buffer)
     Read a number of bytes.
See Also:   InputStream.read(byte[])
Parameters:
  buffer - the buffer into which the data is read.
public  intread(byte[] buffer, int off, int len)
     Read a number of bytes.
See Also:   InputStream.read(byte[]intint)
Parameters:
  buffer - the buffer into which the data is read.
Parameters:
  off - the start offset in array buffer at which the data is written.
Parameters:
  len - the maximum number of bytes to read.
public  voidreset()
     Restore the state of this stream to the last saveState call.
public  intseek(int newpos)
     Position the stream at a given index.
public  intsize()
     Totally available bytes in the underlying array.
public  longskip(long num)
     Skips over and discards n bytes of data from this input stream.
public  voidunread(int by)
     Pushes back a byte.
public  voidunread(byte[] buffer, int off, int len)
     Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer.
public  voidunread(byte[] buffer)
     Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer.


Constructor Detail
ByteArrayPushBackInputStream
public ByteArrayPushBackInputStream(byte[] input) throws IOException(Code)
Constructor.
Parameters:
  input - Data to read from. Note that calls to unread() willmodify this array! If this is not desired, pass a copy.
throws:
  IOException - If there is an IO error.




Method Detail
available
public int available()(Code)
Available bytes.
See Also:   InputStream.available Available bytes.



isEOF
public boolean isEOF()(Code)
A simple test to see if we are at the end of the stream. true if we are at the end of the stream.



localRead
public int localRead(byte[] buffer, int off, int len)(Code)
Read a number of bytes. Internal method that assumes off and len to be valid.
See Also:   InputStream.read(byte[]intint)
Parameters:
  buffer - the buffer into which the data is read.
Parameters:
  off - the start offset in array buffer at which the data is written.
Parameters:
  len - the maximum number of bytes to read. the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.



mark
public void mark(int readlimit)(Code)
Save the state of this stream.
Parameters:
  readlimit - Has no effect.
See Also:   InputStream.mark(int)



markSupported
public boolean markSupported()(Code)
Check if mark is supported. Always true.
See Also:   InputStream.markSupported



peek
public int peek()(Code)
This will peek at the next byte. The next byte on the stream, leaving it as available to read.



read
public int read()(Code)
Read a byte.
See Also:   InputStream.read Byte read or -1 if no more bytes are available.



read
public int read(byte[] buffer)(Code)
Read a number of bytes.
See Also:   InputStream.read(byte[])
Parameters:
  buffer - the buffer into which the data is read. the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.



read
public int read(byte[] buffer, int off, int len)(Code)
Read a number of bytes.
See Also:   InputStream.read(byte[]intint)
Parameters:
  buffer - the buffer into which the data is read.
Parameters:
  off - the start offset in array buffer at which the data is written.
Parameters:
  len - the maximum number of bytes to read. the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.



reset
public void reset()(Code)
Restore the state of this stream to the last saveState call.
See Also:   InputStream.reset



seek
public int seek(int newpos)(Code)
Position the stream at a given index. Positioning the stream at position size() will cause the next call to read() to return -1.
Parameters:
  newpos - Position in the underlying array. A negative value will be interpreted as 0, a value greater than size() as size(). old position.



size
public int size()(Code)
Totally available bytes in the underlying array. Available bytes.



skip
public long skip(long num)(Code)
Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n is negative, no bytes are skipped.
Parameters:
  num - the number of bytes to be skipped. the actual number of bytes skipped.
See Also:   InputStream.skip(long)



unread
public void unread(int by) throws IOException(Code)
Pushes back a byte. After this method returns, the next byte to be read will have the value (byte)by.
Parameters:
  by - the int value whose low-order byte is to be pushed back.
throws:
  IOException - - If there is not enough room in the buffer for the byte.
See Also:   java.io.PushbackInputStream.unread(int)



unread
public void unread(byte[] buffer, int off, int len) throws IOException(Code)
Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer. After this method returns, the next byte to be read will have the value b[off], the byte after that will have the value b[off+1], and so forth.
Parameters:
  buffer - the byte array to push back.
Parameters:
  off - the start offset of the data.
Parameters:
  len - the number of bytes to push back.
throws:
  IOException - If there is not enough room in the pushback buffer for the specified number of bytes.
See Also:   java.io.PushbackInputStream.unread(byte[]intint)



unread
public void unread(byte[] buffer) throws IOException(Code)
Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer. After this method returns, the next byte to be read will have the value buffer[0], the byte after that will have the value buffer[1], and so forth.
Parameters:
  buffer - the byte array to push back.
throws:
  IOException - If there is not enough room in the pushback buffer for the specified number of bytes.
See Also:   java.io.PushbackInputStream.unread(byte[])



Methods inherited from org.pdfbox.io.PushBackInputStream
public void fillBuffer() throws IOException(Code)(Java Doc)
public boolean isEOF() throws IOException(Code)(Java Doc)
public int peek() throws IOException(Code)(Java Doc)

Fields inherited from java.io.PushbackInputStream
protected byte[] buf(Code)(Java Doc)
protected int pos(Code)(Java Doc)

Methods inherited from java.io.PushbackInputStream
public int available() throws IOException(Code)(Java Doc)
public synchronized 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, 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)
public void unread(int b) throws IOException(Code)(Java Doc)
public void unread(byte[] b, int off, int len) throws IOException(Code)(Java Doc)
public void unread(byte[] b) throws IOException(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.