Java Doc for RandomAccessROMFile.java in  » 6.0-JDK-Modules » j2me » sun » 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 » 6.0 JDK Modules » j2me » sun.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      sun.io.RandomAccessROMFile

RandomAccessROMFile
public class RandomAccessROMFile extends InputStream implements DataInput(Code)
Instances of this class support reading of files in ROM. WARNING: This is not production code and is only meant as an example of how to access files romized by JavaDataCompact. Among other things, no attempt is made to syncronize any of the calls. This can result in errors when two threads are trying to access the same file through the same RandomAccessROMFile instance, or if 2 threads are trying to open a romfile at the same time, even if each is opening a different romfile.



Constructor Summary
public  RandomAccessROMFile(String name, String mode)
     Creates a random access file stream to read from with the specified name.
public  RandomAccessROMFile(FileIO file, String mode)
     Creates a random access file stream to read from.

Method Summary
native public  voidclose()
     Closes this random access file stream and releases any system resources associated with the stream.
final public  FileDescriptorgetFD()
     Returns the opaque file descriptor object associated with this stream.
native public  longgetFilePointer()
     Returns the current offset in this file.
native public  longlength()
     Returns the length of this file.
native public  intread()
     Reads a byte of data from this file.
public  intread(byte b, int off, int len)
     Reads up to len bytes of data from this file into an array of bytes.
public  intread(byte b)
     Reads up to b.length bytes of data from this file into an array of bytes.
final public  booleanreadBoolean()
     Reads a boolean from this file.
final public  bytereadByte()
     Reads a signed 8-bit value from this file.
final public  charreadChar()
     Reads a Unicode character from this file.
final public  doublereadDouble()
     Reads a double from this file.
final public  floatreadFloat()
     Reads a float from this file.
final public  voidreadFully(byte b)
     Reads b.length bytes from this file into the byte array.
final public  voidreadFully(byte b, int off, int len)
     Reads exactly len bytes from this file into the byte array.
final public  intreadInt()
     Reads a signed 32-bit integer from this file.
final public  StringreadLine()
     Reads the next line of text from this file.
final public  longreadLong()
     Reads a signed 64-bit integer from this file.
final public  shortreadShort()
     Reads a signed 16-bit number from this file.
final public  StringreadUTF()
     Reads in a string from this file.
final public  intreadUnsignedByte()
     Reads an unsigned 8-bit number from this file.
final public  intreadUnsignedShort()
     Reads an unsigned 16-bit number from this file.
native public  voidseek(long pos)
     Sets the offset from the beginning of this file at which the next read occurs.
public  intskipBytes(int n)
     Skips exactly n bytes of input.


Constructor Detail
RandomAccessROMFile
public RandomAccessROMFile(String name, String mode) throws IOException(Code)
Creates a random access file stream to read from with the specified name.

The mode argument must either be equal to "r".
Parameters:
  name - the system-dependent filename.
Parameters:
  mode - the access mode.
exception:
  IllegalArgumentException - if the mode argument is not equalto "r".
exception:
  IOException - if an I/O error occurs.
exception:
  SecurityException - if a security manager exists, itscheckRead method is called with the nameargument to see if the application is allowed read accessto the file. this may result in a security exception.
See Also:   java.lang.SecurityException
See Also:   java.lang.SecurityManager.checkRead(java.lang.String)




RandomAccessROMFile
public RandomAccessROMFile(FileIO file, String mode) throws IOException(Code)
Creates a random access file stream to read from.

The mode argument must either be equal to "r".
Parameters:
  file - the file object.
Parameters:
  mode - the access mode.
exception:
  IllegalArgumentException - if the mode argument is not equalto "r".
exception:
  IOException - if an I/O error occurs.
exception:
  SecurityException - if a security manager exists, itscheckRead method is called with the pathnameof the File argument to see if theapplication is allowed read access to the file.
See Also:   java.io.File.getPath
See Also:   java.lang.SecurityManager.checkRead(java.lang.String)





Method Detail
close
native public void close() throws IOException(Code)
Closes this random access file stream and releases any system resources associated with the stream.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



getFD
final public FileDescriptor getFD() throws IOException(Code)
Returns the opaque file descriptor object associated with this stream. the file descriptor object associated with this stream.
exception:
  IOException - if an I/O error occurs.
See Also:   java.io.FileDescriptor
since:
   JDK1.0



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



length
native public long length() throws IOException(Code)
Returns the length of this file. the length of this file.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



read
native public int read() throws IOException(Code)
Reads a byte of data from this file. This method blocks if no input is yet available. the next byte of data, or -1 if the end of thefile is reached.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



read
public int read(byte b, int off, int len) throws IOException(Code)
Reads up to len bytes of data from this file into an array of bytes. This method blocks until at least one byte of input is available.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset of the data.
Parameters:
  len - the maximum number of bytes read. the total number of bytes read into the buffer, or-1 if there is no more data because the end ofthe file has been reached.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



read
public int read(byte b) throws IOException(Code)
Reads up to b.length bytes of data from this file into an array of bytes. This method blocks until at least one byte of input is available.
Parameters:
  b - 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 ofthis file has been reached.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



readBoolean
final public boolean readBoolean() throws IOException(Code)
Reads a boolean from this file. This method reads a single byte from the file. 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 file has reached the end.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



readByte
final public byte readByte() throws IOException(Code)
Reads a signed 8-bit value from this file. This method reads a byte from the file. 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 file as a signed 8-bitbyte.
exception:
  EOFException - if this file has reached the end.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readChar
final public char readChar() throws IOException(Code)
Reads a Unicode character from this file. This method reads two bytes from the file. 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 file as a Unicode character.
exception:
  EOFException - if this file reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readDouble
final public double readDouble() throws IOException(Code)
Reads a double from this file. This method reads a long value 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 file, interpreted as adouble.
exception:
  EOFException - if this file reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.
See Also:   java.io.RandomAccessFile.readLong
See Also:   java.lang.Double.longBitsToDouble(long)
since:
   JDK1.0




readFloat
final public float readFloat() throws IOException(Code)
Reads a float from this file. This method reads an int value 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 file, interpreted as afloat.
exception:
  EOFException - if this file reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.
See Also:   java.io.RandomAccessFile.readInt
See Also:   java.lang.Float.intBitsToFloat(int)
since:
   JDK1.0




readFully
final public void readFully(byte b) throws IOException(Code)
Reads b.length bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read. This method blocks until all the 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 file reaches the end before readingall the bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



readFully
final public void readFully(byte b, int off, int len) throws IOException(Code)
Reads exactly len bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read. This method blocks until all the 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 file reaches the end before readingall the bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



readInt
final public int readInt() throws IOException(Code)
Reads a signed 32-bit integer from this file. This method reads 4 bytes from the file. 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 file, interpreted as anint.
exception:
  EOFException - if this file reaches the end before readingfour bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readLine
final public String readLine() throws IOException(Code)
Reads the next line of text from this file. This method successively reads bytes from the file until it reaches the end of a line of text.

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 input stream. The line-terminating character(s), if any, are 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 detected, or an exception is thrown. the next line of text from this file.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readLong
final public long readLong() throws IOException(Code)
Reads a signed 64-bit integer from this file. This method reads eight bytes from the file. 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 file, interpreted as along.
exception:
  EOFException - if this file reaches the end before readingeight bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readShort
final public short readShort() throws IOException(Code)
Reads a signed 16-bit number from this file. The method reads 2 bytes from this file. 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 file, interpreted as a signed16-bit number.
exception:
  EOFException - if this file reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




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

The first two bytes are read 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 file 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.
See Also:   java.io.RandomAccessFile.readUnsignedShort
since:
   JDK1.0




readUnsignedByte
final public int readUnsignedByte() throws IOException(Code)
Reads an unsigned 8-bit number from this file. This method reads a byte from this file 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 file, interpreted as an unsigned8-bit number.
exception:
  EOFException - if this file has reached the end.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




readUnsignedShort
final public int readUnsignedShort() throws IOException(Code)
Reads an unsigned 16-bit number from this file. This method reads two bytes from the file. 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 file, interpreted as an unsigned16-bit integer.
exception:
  EOFException - if this file reaches the end before readingtwo bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




seek
native public void seek(long pos) throws IOException(Code)
Sets the offset from the beginning of this file at which the next read occurs.
Parameters:
  pos - the absolute position.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0



skipBytes
public int skipBytes(int n) throws IOException(Code)
Skips exactly n bytes of input.

This method blocks until all the bytes are skipped, the end of the stream is detected, or an exception is thrown.
Parameters:
  n - the number of bytes to be skipped. the number of bytes skipped, which is always n.
exception:
  EOFException - if this file reaches the end before skippingall the bytes.
exception:
  IOException - if an I/O error occurs.
since:
   JDK1.0




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
public boolean equals(Object obj)(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.