Java Doc for SeekableStream.java in  » Graphic-Library » xmlgraphics-commons-1.2 » org » apache » xmlgraphics » image » codec » 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 » Graphic Library » xmlgraphics commons 1.2 » org.apache.xmlgraphics.image.codec.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      org.apache.xmlgraphics.image.codec.util.SeekableStream

All known Subclasses:   org.apache.xmlgraphics.image.codec.util.ForwardSeekableStream,  org.apache.xmlgraphics.image.codec.util.FileCacheSeekableStream,  org.apache.xmlgraphics.image.codec.util.MemoryCacheSeekableStream,
SeekableStream
abstract public class SeekableStream extends InputStream implements DataInput(Code)
An abstract subclass of java.io.InputStream that allows seeking within the input, similar to the RandomAccessFile class. Additionally, the DataInput interface is supported and extended to include support for little-endian representations of fundamental data types.

In addition to the familiar methods from InputStream, the methods getFilePointer(), seek(), are defined as in the RandomAccessFile class. The canSeekBackwards() method will return true if it is permissible to seek to a position earlier in the stream than the current value of getFilePointer(). Some subclasses of SeekableStream guarantee the ability to seek backwards while others may not offer this feature in the interest of providing greater efficiency for those users who do not require it.

The DataInput interface is supported as well. This included the skipBytes() and readFully() methods and a variety of read methods for various data types.

A number of concrete subclasses of SeekableStream are supplied in the com.sun.media.jai.codec package.

Three classes are provided for the purpose of adapting a standard InputStream to the SeekableStream interface. ForwardSeekableStream does not allows seeking backwards, but is inexpensive to use. FileCacheSeekableStream maintains a copy of all of the data read from the input in a temporary file; this file will be discarded automatically when the FileSeekableStream is finalized, or when the JVM exits normally. FileCacheSeekableStream is intended to be reasonably efficient apart from the unavoidable use of disk space. In circumstances where the creation of a temporary file is not possible, MemoryCacheSeekableStream may be used. MemoryCacheSeekableStream creates a potentially large in-memory buffer to store the stream data and so should be avoided when possible.

The FileSeekableStream class wraps a File or RandomAccessFile. It forwards requests to the real underlying file. It performs a limited amount of caching in order to avoid excessive I/O costs.

The SegmentedSeekableStream class performs a different sort of function. It creates a SeekableStream from another SeekableStream by selecting a series of portions or "segments". Each segment starts at a specified location within the source SeekableStream and extends for a specified number of bytes. The StreamSegmentMapper interface and StreamSegment class may be used to compute the segment positions dynamically.

A convenience methods, wrapInputStream is provided to construct a suitable SeekableStream instance whose data is supplied by a given InputStream. The caller, by means of the canSeekBackwards parameter, determines whether support for seeking backwards is required.



Field Summary
protected  longmarkPos
    


Method Summary
public  booleancanSeekBackwards()
     Returns true if this object supports calls to seek(pos) with an offset pos smaller than the current offset, as returned by getFilePointer.
protected  voidfinalize()
     Releases any system resources associated with this stream by calling the close() method.
abstract public  longgetFilePointer()
     Returns the current offset in this stream.
public synchronized  voidmark(int readLimit)
     Marks the current file position for later return using the reset() method.
public  booleanmarkSupported()
     Returns true if marking is supported. Marking is automatically supported for SeekableStream subclasses that support seeking backeards.
abstract public  intread()
     Reads the next byte of data from the input stream.
abstract public  intread(byte[] b, int off, int len)
     Reads up to len bytes of data from the input stream into an array of bytes.
final public  booleanreadBoolean()
     Reads a boolean from this stream.
final public  bytereadByte()
     Reads a signed eight-bit value from this stream.
final public  charreadChar()
     Reads a Unicode character from this stream.
final public  charreadCharLE()
     Reads a Unicode character from this stream in little-endian order. This method reads two bytes from the stream, starting at the current stream pointer.
final public  doublereadDouble()
     Reads a double from this stream.
final public  doublereadDoubleLE()
     Reads a double from this stream in little-endian order. This method reads a long value, starting at the current stream pointer, as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

final public  floatreadFloat()
     Reads a float from this stream.
final public  floatreadFloatLE()
     Reads a float from this stream in little-endian order. This method reads an int value, starting at the current stream pointer, as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.
final public  voidreadFully(byte[] b)
     Reads b.length bytes from this stream into the byte array, starting at the current stream pointer.
final public  voidreadFully(byte[] b, int off, int len)
     Reads exactly len bytes from this stream into the byte array, starting at the current stream pointer.
final public  intreadInt()
     Reads a signed 32-bit integer from this stream.
final public  intreadIntLE()
     Reads a signed 32-bit integer from this stream in little-endian order. This method reads 4 bytes from the stream, starting at the current stream pointer.
final public  StringreadLine()
     Reads the next line of text from this stream.
final public  longreadLong()
     Reads a signed 64-bit integer from this stream.
final public  longreadLongLE()
     Reads a signed 64-bit integer from this stream in little-endian order.
final public  shortreadShort()
     Reads a signed 16-bit number from this stream. The method reads two bytes from this stream, starting at the current stream pointer.
final public  shortreadShortLE()
     Reads a signed 16-bit number from this stream in little-endian order. The method reads two bytes from this stream, starting at the current stream pointer.
final public  StringreadUTF()
     Reads in a string from this stream.
final public  intreadUnsignedByte()
     Reads an unsigned eight-bit number from this stream.
final public  longreadUnsignedInt()
     Reads an unsigned 32-bit integer from this stream.
final public  longreadUnsignedIntLE()
     Reads an unsigned 32-bit integer from this stream in little-endian order.
final public  intreadUnsignedShort()
     Reads an unsigned 16-bit number from this stream.
final public  intreadUnsignedShortLE()
     Reads an unsigned 16-bit number from this stream in little-endian order. This method reads two bytes from the stream, starting at the current stream pointer.
public synchronized  voidreset()
     Returns the file position to its position at the time of the immediately previous call to the mark() method.
abstract public  voidseek(long pos)
     Sets the offset, measured from the beginning of this stream, at which the next read occurs.
public  intskipBytes(int n)
     Attempts to skip over n bytes of input discarding the skipped bytes.
public static  SeekableStreamwrapInputStream(InputStream is, boolean canSeekBackwards)
     Returns a SeekableStream that will read from a given InputStream, optionally including support for seeking backwards.

Field Detail
markPos
protected long markPos(Code)
Marked position





Method Detail
canSeekBackwards
public boolean canSeekBackwards()(Code)
Returns true if this object supports calls to seek(pos) with an offset pos smaller than the current offset, as returned by getFilePointer.



finalize
protected void finalize() throws Throwable(Code)
Releases any system resources associated with this stream by calling the close() method.



getFilePointer
abstract public long getFilePointer() throws IOException(Code)
Returns the current offset in this stream. the offset from the beginning of the stream, in bytes,at which the next read occurs.
exception:
  IOException - if an I/O error occurs.



mark
public synchronized void mark(int readLimit)(Code)
Marks the current file position for later return using the reset() method.



markSupported
public boolean markSupported()(Code)
Returns true if marking is supported. Marking is automatically supported for SeekableStream subclasses that support seeking backeards. Subclasses that do not support seeking backwards but do support marking must override this method.



read
abstract public int read() throws IOException(Code)
Reads the next byte of data from the 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.

A subclass must provide an implementation of this method. the next byte of data, or -1 if the end of thestream is reached.
exception:
  IOException - if an I/O error occurs.




read
abstract public int read(byte[] b, int off, int len) throws IOException(Code)
Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.

This method blocks until input data is available, end of stream is detected, or an exception is thrown.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of stream, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], leaving elements b[off+k] through b[off+len-1] unaffected.

In every case, elements b[0] through b[off] and elements b[off+len] through b[b.length-1] are unaffected.

If the first byte cannot be read for any reason other than end of stream, then an IOException is thrown. In particular, an IOException is thrown if the input stream has been closed.

A subclass must provide an implementation of this method.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat 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 ofthe stream has been reached.
exception:
  IOException - if an I/O error occurs.




readBoolean
final public boolean readBoolean() throws IOException(Code)
Reads a boolean from this stream. This method reads a single byte from the stream, starting at the current stream pointer. A value of 0 represents false. Any other value represents true. This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown. the boolean value read.
exception:
  EOFException - if this stream has reached the end.
exception:
  IOException - if an I/O error occurs.



readByte
final public byte readByte() throws IOException(Code)
Reads a signed eight-bit value from this stream. This method reads a byte from the stream, starting from the current stream pointer. If the byte read is b, where 0 <= b <= 255, then the result is:
 (byte)(b)
 

This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown. the next byte of this stream as a signed eight-bitbyte.
exception:
  EOFException - if this stream has reached the end.
exception:
  IOException - if an I/O error occurs.




readChar
final public char readChar() throws IOException(Code)
Reads a Unicode character from this stream. This method reads two bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
 (char)((b1 << 8) | b2)
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream as a Unicode character.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




readCharLE
final public char readCharLE() throws IOException(Code)
Reads a Unicode character from this stream in little-endian order. This method reads two bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
 (char)((b2 << 8) | b1)
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream as a Unicode character.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




readDouble
final public double readDouble() throws IOException(Code)
Reads a double from this stream. This method reads a long value, starting at the current stream pointer, as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown. the next eight bytes of this stream, interpreted as adouble.
exception:
  EOFException - if this stream reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.




readDoubleLE
final public double readDoubleLE() throws IOException(Code)
Reads a double from this stream in little-endian order. This method reads a long value, starting at the current stream pointer, as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown. the next eight bytes of this stream, interpreted as adouble.
exception:
  EOFException - if this stream reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.




readFloat
final public float readFloat() throws IOException(Code)
Reads a float from this stream. This method reads an int value, starting at the current stream pointer, as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as afloat.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readFloatLE
final public float readFloatLE() throws IOException(Code)
Reads a float from this stream in little-endian order. This method reads an int value, starting at the current stream pointer, as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as afloat.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readFully
final public void readFully(byte[] b) throws IOException(Code)
Reads b.length bytes from this stream into the byte array, starting at the current stream pointer. This method reads repeatedly from the stream until the requested number of bytes are read. This method blocks until the requested number of bytes are read, the end of the stream is detected, or an exception is thrown.
Parameters:
  b - the buffer into which the data is read.
exception:
  EOFException - if this stream reaches the end before readingall the bytes.
exception:
  IOException - if an I/O error occurs.



readFully
final public void readFully(byte[] b, int off, int len) throws IOException(Code)
Reads exactly len bytes from this stream into the byte array, starting at the current stream pointer. This method reads repeatedly from the stream until the requested number of bytes are read. This method blocks until the requested number of bytes are read, the end of the stream is detected, or an exception is thrown.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset of the data.
Parameters:
  len - the number of bytes to read.
exception:
  EOFException - if this stream reaches the end before readingall the bytes.
exception:
  IOException - if an I/O error occurs.



readInt
final public int readInt() throws IOException(Code)
Reads a signed 32-bit integer from this stream. This method reads 4 bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
 (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
 

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as anint.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readIntLE
final public int readIntLE() throws IOException(Code)
Reads a signed 32-bit integer from this stream in little-endian order. This method reads 4 bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
 (b4 << 24) | (b3 << 16) + (b2 << 8) + b1
 

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as anint.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readLine
final public String readLine() throws IOException(Code)
Reads the next line of text from this stream. This method successively reads bytes from the stream, starting at the current stream pointer, until it reaches a line terminator or the end of the stream. Each byte is converted into a character by taking the byte's value for the lower eight bits of the character and setting the high eight bits of the character to zero. This method does not, therefore, support the full Unicode character set.

A line of text is terminated by a carriage-return character ('\r'), a newline character ('\n'), a carriage-return character immediately followed by a newline character, or the end of the stream. Line-terminating characters are discarded and are not included as part of the string returned.

This method blocks until a newline character is read, a carriage return and the byte following it are read (to see if it is a newline), the end of the stream is reached, or an exception is thrown. the next line of text from this stream, or null if endof stream is encountered before even one byte is read.
exception:
  IOException - if an I/O error occurs.




readLong
final public long readLong() throws IOException(Code)
Reads a signed 64-bit integer from this stream. This method reads eight bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, b4, b5, b6, b7, and b8, where:
 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
 

then the result is equal to:

 ((long)b1 << 56) + ((long)b2 << 48)
 + ((long)b3 << 40) + ((long)b4 << 32)
 + ((long)b5 << 24) + ((long)b6 << 16)
 + ((long)b7 << 8) + b8
 

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown. the next eight bytes of this stream, interpreted as along.
exception:
  EOFException - if this stream reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.




readLongLE
final public long readLongLE() throws IOException(Code)
Reads a signed 64-bit integer from this stream in little-endian order. This method reads eight bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, b4, b5, b6, b7, and b8, where:
 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
 

then the result is equal to:

 ((long)b1 << 56) + ((long)b2 << 48)
 + ((long)b3 << 40) + ((long)b4 << 32)
 + ((long)b5 << 24) + ((long)b6 << 16)
 + ((long)b7 << 8) + b8
 

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown. the next eight bytes of this stream, interpreted as along.
exception:
  EOFException - if this stream reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.




readShort
final public short readShort() throws IOException(Code)
Reads a signed 16-bit number from this stream. The method reads two bytes from this stream, starting at the current stream pointer. If the two bytes read, in order, are b1 and b2, where each of the two values is between 0 and 255, inclusive, then the result is equal to:
 (short)((b1 << 8) | b2)
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream, interpreted as a signed16-bit number.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




readShortLE
final public short readShortLE() throws IOException(Code)
Reads a signed 16-bit number from this stream in little-endian order. The method reads two bytes from this stream, starting at the current stream pointer. If the two bytes read, in order, are b1 and b2, where each of the two values is between 0 and 255, inclusive, then the result is equal to:
 (short)((b2 << 8) | b1)
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream, interpreted as a signed16-bit number.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




readUTF
final public String readUTF() throws IOException(Code)
Reads in a string from this stream. The string has been encoded using a modified UTF-8 format.

The first two bytes are read, starting from the current stream pointer, as if by readUnsignedShort. This value gives the number of following bytes that are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding characters in the UTF-8 format and are converted into characters.

This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown. a Unicode string.
exception:
  EOFException - if this stream reaches the end beforereading all the bytes.
exception:
  IOException - if an I/O error occurs.
exception:
  UTFDataFormatException - if the bytes do not represent valid UTF-8 encoding of a Unicode string.




readUnsignedByte
final public int readUnsignedByte() throws IOException(Code)
Reads an unsigned eight-bit number from this stream. This method reads a byte from this stream, starting at the current stream pointer, and returns that byte.

This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown. the next byte of this stream, interpreted as an unsignedeight-bit number.
exception:
  EOFException - if this stream has reached the end.
exception:
  IOException - if an I/O error occurs.




readUnsignedInt
final public long readUnsignedInt() throws IOException(Code)
Reads an unsigned 32-bit integer from this stream. This method reads 4 bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
 (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
 

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as along.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readUnsignedIntLE
final public long readUnsignedIntLE() throws IOException(Code)
Reads an unsigned 32-bit integer from this stream in little-endian order. This method reads 4 bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
 (b4 << 24) | (b3 << 16) + (b2 << 8) + b1
 

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown. the next four bytes of this stream, interpreted as along.
exception:
  EOFException - if this stream reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.




readUnsignedShort
final public int readUnsignedShort() throws IOException(Code)
Reads an unsigned 16-bit number from this stream. This method reads two bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
 (b1 << 8) | b2
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream, interpreted as anunsigned 16-bit integer.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




readUnsignedShortLE
final public int readUnsignedShortLE() throws IOException(Code)
Reads an unsigned 16-bit number from this stream in little-endian order. This method reads two bytes from the stream, starting at the current stream pointer. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
 (b2 << 8) | b1
 

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown. the next two bytes of this stream, interpreted as anunsigned 16-bit integer.
exception:
  EOFException - if this stream reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.




reset
public synchronized void reset() throws IOException(Code)
Returns the file position to its position at the time of the immediately previous call to the mark() method.



seek
abstract public void seek(long pos) throws IOException(Code)
Sets the offset, measured from the beginning of this stream, at which the next read occurs.

If canSeekBackwards() returns false, then setting pos to an offset smaller than the current value of getFilePointer() will have no effect.
Parameters:
  pos - the offset position, measured in bytes from the beginning of the stream, at which to set the stream pointer.
exception:
  IOException - if pos is less than 0 or if an I/O error occurs.




skipBytes
public int skipBytes(int n) throws IOException(Code)
Attempts to skip over n bytes of input discarding the skipped bytes.

This method may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of stream before n bytes have been skipped is only one possibility. This method never throws an EOFException. The actual number of bytes skipped is returned. If n is negative, no bytes are skipped.
Parameters:
  n - the number of bytes to be skipped. the actual number of bytes skipped.
exception:
  IOException - if an I/O error occurs.




wrapInputStream
public static SeekableStream wrapInputStream(InputStream is, boolean canSeekBackwards)(Code)
Returns a SeekableStream that will read from a given InputStream, optionally including support for seeking backwards. This is a convenience method that avoids the need to instantiate specific subclasses of SeekableStream depending on the current security model.
Parameters:
  is - An InputStream.
Parameters:
  canSeekBackwards - true if the ability to seekbackwards in the output is required. An instance of SeekableStream.



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.