Java Doc for ObjectInputStream.java in  » Apache-Harmony-Java-SE » java-package » java » 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 » Apache Harmony Java SE » java package » java.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      java.io.ObjectInputStream

ObjectInputStream
public class ObjectInputStream extends InputStream implements ObjectInput,ObjectStreamConstants(Code)
An ObjectInputStream can be used to load Java objects from a stream where the objects were saved using an ObjectOutputStream. Primitive data (ints, bytes, chars, etc) can also be loaded if the data was saved as primitive types as well. It is invalid to attempt to read an object as primitive data.
See Also:   ObjectOutputStream
See Also:   ObjectInput
See Also:   Serializable
See Also:   Externalizable

Inner Class :static class InputValidationDesc
Inner Class :abstract public static class GetField


Constructor Summary
protected  ObjectInputStream()
     Constructs a new ObjectInputStream.
public  ObjectInputStream(InputStream input)
     Constructs a new ObjectInputStream on the InputStream input.

Method Summary
public  intavailable()
     Returns the number of bytes of primitive data available from the receiver.
public  voidclose()
     Close this ObjectInputStream.
public  voiddefaultReadObject()
     Default method to read objects from the receiver.
protected  booleanenableResolveObject(boolean enable)
     Enables/disables object replacement for the receiver.
public  intread()
     Reads a single byte from the receiver and returns the result as an int.
public  intread(byte[] buffer, int offset, int length)
     Reads at most length bytes from the receiver and stores them in byte array buffer starting at offset offset.
public  booleanreadBoolean()
    
public  bytereadByte()
    
public  charreadChar()
    
protected  ObjectStreamClassreadClassDescriptor()
     Reads a new class descriptor from the receiver.
public  doublereadDouble()
    
public  GetFieldreadFields()
     Reads the fields of the object being read from the stream.
public  floatreadFloat()
    
public  voidreadFully(byte[] buffer)
     Reads bytes from the receiver into the byte array buffer.
public  voidreadFully(byte[] buffer, int offset, int length)
     Reads bytes from the receiver into the byte array buffer.
public  intreadInt()
    
public  StringreadLine()
    
public  longreadLong()
    
final public  ObjectreadObject()
     Read the next object from the receiver's underlying stream.
protected  ObjectreadObjectOverride()
     Method to be overriden by subclasses to read the next object from the receiver's underlying stream.
public  shortreadShort()
    
protected  voidreadStreamHeader()
    
public  StringreadUTF()
    
public  ObjectreadUnshared()
     Read the next unshared object from the receiver's underlying stream.
public  intreadUnsignedByte()
    
public  intreadUnsignedShort()
    
public synchronized  voidregisterValidation(ObjectInputValidation object, int priority)
     Register object validator object to be executed to perform validation of objects loaded from the receiver.
protected  ClassresolveClass(ObjectStreamClass osClass)
     Loads the Java class corresponding to the class descriptor osClass(ObjectStreamClass) just read from the receiver.
Parameters:
  osClass - An ObjectStreamClass read from the receiver.
protected  ObjectresolveObject(Object object)
     If enableResolveObject() was activated, computes the replacement object for the original object object and returns the replacement.
protected  ClassresolveProxyClass(String[] interfaceNames)
     Retrieves the proxy class corresponding to the interface names.
public  intskipBytes(int length)
     Skips length bytes of primitive data from the receiver.


Constructor Detail
ObjectInputStream
protected ObjectInputStream() throws IOException, SecurityException(Code)
Constructs a new ObjectInputStream. The representation and proper initialization is on the hands of subclasses.
throws:
  IOException - If not called from a subclass
throws:
  SecurityException - If subclasses are not allowed
See Also:   SecurityManager.checkPermission(java.security.Permission)



ObjectInputStream
public ObjectInputStream(InputStream input) throws StreamCorruptedException, IOException(Code)
Constructs a new ObjectInputStream on the InputStream input. All reads are now filtered through this stream.
Parameters:
  input - The non-null InputStream to filter reads on.
throws:
  IOException - If an IO exception happened when reading the stream header.
throws:
  StreamCorruptedException - If the underlying stream does not contain serialized objectsthat can be read.




Method Detail
available
public int available() throws IOException(Code)
Returns the number of bytes of primitive data available from the receiver. It should not be used at any arbitrary position; just when reading primitive data types (ints, chars, etc). the number of available primitive data bytes
throws:
  IOException - If any IO problem occurred when trying to compute the bytesavailable.



close
public void close() throws IOException(Code)
Close this ObjectInputStream. This implementation closes the target stream.
throws:
  IOException - If an error occurs attempting to close this stream.



defaultReadObject
public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException(Code)
Default method to read objects from the receiver. Fields defined in the object's class and super classes (which are Serializable) will be read.
throws:
  IOException - If an IO error occurs attempting to read the object data
throws:
  ClassNotFoundException - If the class of the object cannot be found
throws:
  NotActiveException - If this method is not called from readObject()
See Also:   ObjectOutputStream.defaultWriteObject



enableResolveObject
protected boolean enableResolveObject(boolean enable) throws SecurityException(Code)
Enables/disables object replacement for the receiver. By default this is not enabled. Only trusted subclasses (loaded with system class loader) can override this behavior.
Parameters:
  enable - if true, enables replacement. If false, disables replacement. the previous configuration (if it was enabled or disabled)
throws:
  SecurityException - If the class of the receiver is not trusted
See Also:   ObjectInputStream.resolveObject
See Also:   ObjectOutputStream.enableReplaceObject



read
public int read() throws IOException(Code)
Reads a single byte from the receiver and returns the result as an int. The low-order byte is returned or -1 of the end of stream was encountered. The byte read or -1 if end of stream.
throws:
  IOException - If an IO exception happened when reading the primitive data.



read
public int read(byte[] buffer, int offset, int length) throws IOException(Code)
Reads at most length bytes from the receiver and stores them in byte array buffer starting at offset offset. Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered.
Parameters:
  buffer - the byte array in which to store the read bytes.
Parameters:
  offset - the offset in buffer to store the read bytes.
Parameters:
  length - the maximum number of bytes to store in buffer. The number of bytes actually read or -1 if end of stream.
throws:
  IOException - If an IO exception happened when reading the primitive data.



readBoolean
public boolean readBoolean() throws IOException(Code)
Reads and returns primitive data of type boolean read from the receiver A boolean saved as primitive data usingObjectOutputStream.writeBoolean()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readByte
public byte readByte() throws IOException(Code)
Reads and returns primitive data of type byte read from the receiver A byte saved as primitive data usingObjectOutputStream.writeByte()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readChar
public char readChar() throws IOException(Code)
Reads and returns primitive data of type char read from the receiver A char saved as primitive data usingObjectOutputStream.writeChar()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readClassDescriptor
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException(Code)
Reads a new class descriptor from the receiver. Return the class descriptor read. The ObjectStreamClass read from the stream.
throws:
  IOException - If an IO exception happened when reading the classdescriptor.
throws:
  ClassNotFoundException - If a class for one of the objects could not be found



readDouble
public double readDouble() throws IOException(Code)
Reads and returns primitive data of type double read from the receiver A double saved as primitive data usingObjectOutputStream.writeDouble()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readFields
public GetField readFields() throws IOException, ClassNotFoundException, NotActiveException(Code)
Reads the fields of the object being read from the stream. The stream will use the currently active getField object, allowing users to load emulated fields, for cross-loading compatibility when a class definition changes. the fields being read
throws:
  IOException - If an IO exception happened
throws:
  ClassNotFoundException - If a class of an object being de-serialized can not be found
throws:
  NotActiveException - If there is no object currently being loaded (invalid to callthis method)



readFloat
public float readFloat() throws IOException(Code)
Reads and returns primitive data of type float read from the receiver A float saved as primitive data usingObjectOutputStream.writeFloat()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readFully
public void readFully(byte[] buffer) throws IOException(Code)
Reads bytes from the receiver into the byte array buffer. This method will block until buffer.length number of bytes have been read.
Parameters:
  buffer - the buffer to read bytes into
throws:
  IOException - if a problem occurs reading from this stream.



readFully
public void readFully(byte[] buffer, int offset, int length) throws IOException(Code)
Reads bytes from the receiver into the byte array buffer. This method will block until length number of bytes have been read.
Parameters:
  buffer - the byte array in which to store the read bytes.
Parameters:
  offset - the offset in buffer to store the read bytes.
Parameters:
  length - the maximum number of bytes to store in buffer.
throws:
  IOException - if a problem occurs reading from this stream.



readInt
public int readInt() throws IOException(Code)
Reads and returns primitive data of type int read from the receiver an int saved as primitive data usingObjectOutputStream.writeInt()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readLine
public String readLine() throws IOException(Code)
Reads and returns the next line (primitive data of type String) read from the receiver a String saved as primitive data usingObjectOutputStream.writeLine()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readLong
public long readLong() throws IOException(Code)
Reads and returns primitive data of type long read from the receiver a long saved as primitive data usingObjectOutputStream.writeLong()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readObject
final public Object readObject() throws OptionalDataException, ClassNotFoundException, IOException(Code)
Read the next object from the receiver's underlying stream. the new object read.
throws:
  IOException - If an IO exception happened when reading the object
throws:
  ClassNotFoundException - If the class of one of the objects in the object graph couldnot be found
throws:
  OptionalDataException - If primitive data types were found instead of an object.
See Also:   ObjectOutputStream.writeObject(Object)



readObjectOverride
protected Object readObjectOverride() throws OptionalDataException, ClassNotFoundException, IOException(Code)
Method to be overriden by subclasses to read the next object from the receiver's underlying stream. the new object read.
throws:
  IOException - If an IO exception happened when reading the object
throws:
  ClassNotFoundException - If the class of one of the objects in the object graph couldnot be found
throws:
  OptionalDataException - If primitive data types were found instead of an object.
See Also:   ObjectOutputStream.writeObjectOverride



readShort
public short readShort() throws IOException(Code)
Reads and returns primitive data of type short from the receiver a short saved as primitive data usingObjectOutputStream.writeShort()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readStreamHeader
protected void readStreamHeader() throws IOException, StreamCorruptedException(Code)
Reads and validates the ObjectInputStream header from the receiver
throws:
  IOException - If an IO exception happened when reading the stream header.
throws:
  StreamCorruptedException - If the underlying stream does not contain serialized objectsthat can be read.



readUTF
public String readUTF() throws IOException(Code)
Reads and returns primitive data of type String read in UTF format from the receiver a String saved as primitive data usingObjectOutputStream.writeUTF()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readUnshared
public Object readUnshared() throws IOException, ClassNotFoundException(Code)
Read the next unshared object from the receiver's underlying stream. the new object read.
throws:
  IOException - If an IO exception happened when reading the object
throws:
  ClassNotFoundException - If the class of one of the objects in the object graph couldnot be found
See Also:   ObjectOutputStream.writeUnshared



readUnsignedByte
public int readUnsignedByte() throws IOException(Code)
Reads and returns primitive data of type byte (unsigned) from the receiver a byte saved as primitive data usingObjectOutputStream.writeUnsignedByte()
throws:
  IOException - If an IO exception happened when reading the primitive data.



readUnsignedShort
public int readUnsignedShort() throws IOException(Code)
Reads and returns primitive data of type short (unsigned) from the receiver a short saved as primitive data usingObjectOutputStream.writeUnsignedShort()
throws:
  IOException - If an IO exception happened when reading the primitive data.



registerValidation
public synchronized void registerValidation(ObjectInputValidation object, int priority) throws NotActiveException, InvalidObjectException(Code)
Register object validator object to be executed to perform validation of objects loaded from the receiver. Validations will be run in order of decreasing priority, defined by priority.
Parameters:
  object - An ObjectInputValidation to validate objects loaded.
Parameters:
  priority - validator priority
throws:
  NotActiveException - If this method is not called from readObject()
throws:
  InvalidObjectException - If object is null.



resolveClass
protected Class resolveClass(ObjectStreamClass osClass) throws IOException, ClassNotFoundException(Code)
Loads the Java class corresponding to the class descriptor osClass(ObjectStreamClass) just read from the receiver.
Parameters:
  osClass - An ObjectStreamClass read from the receiver. a Class corresponding to the descriptor loaded.
throws:
  IOException - If any IO problem occurred when trying to load the class.
throws:
  ClassNotFoundException - If the corresponding class cannot be found.



resolveObject
protected Object resolveObject(Object object) throws IOException(Code)
If enableResolveObject() was activated, computes the replacement object for the original object object and returns the replacement. Otherwise returns object.
Parameters:
  object - Original object for which a replacement may be defined a possibly new, replacement object for object
throws:
  IOException - If any IO problem occurred when trying to resolve the object.
See Also:   ObjectInputStream.enableResolveObject
See Also:   ObjectOutputStream.enableReplaceObject
See Also:   ObjectOutputStream.replaceObject



resolveProxyClass
protected Class resolveProxyClass(String[] interfaceNames) throws IOException, ClassNotFoundException(Code)
Retrieves the proxy class corresponding to the interface names.
Parameters:
  interfaceNames - The interfaces used to create the proxy class A proxy class
throws:
  IOException - If any IO problem occurred when trying to load the class.
throws:
  ClassNotFoundException - If the proxy class cannot be created



skipBytes
public int skipBytes(int length) throws IOException(Code)
Skips length bytes of primitive data from the receiver. It should not be used to skip bytes at any arbitrary position; just when reading primitive data types (ints, chars, etc).
Parameters:
  length - How many bytes to skip number of bytes skipped
throws:
  IOException - If any IO problem occurred when trying to skip the bytes.



Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public 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 offset, int length) 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
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.