|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSCoder
NSCoder is an abstract class that declares the API used by concrete subclasses to transfer objects and other data items between memory and some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads).
You should never need to subclass NSCoder. Rather, WebObjects provides private concrete subclasses that it uses by default. However, you might interact with a coder object if you create a class that implements the NSCoding interface.
NSCoder operates on scalars (booleans, bytes, and integers, for example), and any other types of object. A coder object stores object type information along with an object's data, so an object decoded from a stream of bytes is normally of the same class as the object that was originally encoded into the stream.
encode...
methods. To decode an object or data item, simply use the decode...
method corresponding to the original encode...
method.
Matching these is important, as the method originally used determines
the format of the encoded data.
NSCoder's interface is quite general. Concrete subclasses aren't
required to properly implement all of NSCoder's methods, and may
explicitly restrict themselves to certain types of operations.
encodeObject
method preserves the graph structure.
NSCoding
,
encodeObject(Object object)
Constructor Summary | |
NSCoder()
|
Method Summary | |
abstract boolean |
decodeBoolean()
Decodes a boolean value that was previously encoded with encodeBoolean . |
abstract byte |
decodeByte()
Decodes a byte value that was previously encoded with encodeByte . |
abstract byte[] |
decodeBytes()
Decodes an array of byte values that were previously encoded with encodeBytes . |
abstract char |
decodeChar()
Decodes a character value that was previously encoded with encodeChar . |
abstract Class |
decodeClass()
Decodes a class that was previously encoded with encodeClass . |
abstract double |
decodeDouble()
Decodes a double value that was previously encoded with encodeDouble . |
abstract float |
decodeFloat()
Decodes a float value that was previously encoded with encodeFloat . |
abstract int |
decodeInt()
Decodes an integer value that was previously encoded with encodeInt . |
abstract long |
decodeLong()
Decodes a long value that was previously encoded with encodeLong . |
abstract Object |
decodeObject()
Decodes an object that was previously encoded with encodeObject . |
abstract Object[] |
decodeObjects()
Decodes an array of objects that were previously encoded with encodeObjects . |
abstract short |
decodeShort()
Decodes a short value that was previously encoded with encodeShort . |
abstract void |
encodeBoolean(boolean aBoolean)
Encodes a boolean value. |
abstract void |
encodeByte(byte aByte)
Encodes a byte value. |
abstract void |
encodeBytes(byte[] bytes)
Encodes an array of bytes. |
abstract void |
encodeChar(char aChar)
Encodes a character value. |
abstract void |
encodeClass(Class aClass)
Encodes a class. |
abstract void |
encodeDouble(double aDouble)
Encodes a double value. |
abstract void |
encodeFloat(float aFloat)
Encodes a float value. |
abstract void |
encodeInt(int anInt)
Encodes an integer value. |
abstract void |
encodeLong(long aLong)
Encodes a long value. |
abstract void |
encodeObject(Object object)
Encodes an object. |
abstract void |
encodeObjects(Object[] objects)
Encodes an array of objects. |
abstract void |
encodeShort(short aShort)
Encodes a short value. |
void |
finishCoding()
Cleans up the receiver's state after the receiver has finished encoding data. |
void |
prepareForReading(InputStream stream)
Prepares the receiver for reading data from stream . |
void |
prepareForWriting(OutputStream stream)
Prepares the receiver for writing to stream . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NSCoder()
Method Detail |
public abstract boolean decodeBoolean()
encodeBoolean
.
encodeBoolean(boolean aBoolean)
public abstract byte decodeByte()
encodeByte
.
encodeByte(byte aByte)
public abstract byte[] decodeBytes()
encodeBytes
.
encodeBytes(byte[])
public abstract char decodeChar()
encodeChar
.
encodeChar(char aChar)
public abstract Class decodeClass()
encodeClass
.
encodeClass(Class aClass)
public abstract double decodeDouble()
encodeDouble
.
encodeDouble(double aDouble)
public abstract float decodeFloat()
encodeFloat
.
encodeFloat(float aFloat)
public abstract int decodeInt()
encodeInt
.
encodeInt(int anInt)
public abstract long decodeLong()
encodeLong
.
encodeLong(long aLong)
public abstract Object decodeObject()
encodeObject
.
encodeObject(Object object)
public abstract Object[] decodeObjects()
encodeObjects
.
encodeObjects(Object[] objects)
public abstract short decodeShort()
encodeShort
.
encodeShort(short aShort)
public abstract void encodeBoolean(boolean aBoolean)
decodeBoolean
.
aBoolean
- the boolean value to be encodeddecodeBoolean()
public abstract void encodeByte(byte aByte)
decodeByte
.
aByte
- the byte value to be encodeddecodeByte()
public abstract void encodeBytes(byte[] bytes)
decodeBytes
.
bytes
- the byte array to be encodeddecodeBytes()
public abstract void encodeChar(char aChar)
decodeChar
.
aChar
- the character value to be encodeddecodeChar()
public abstract void encodeClass(Class aClass)
decodeClass
.
aClass
- the class to be encodeddecodeClass()
public abstract void encodeDouble(double aDouble)
decodeDouble
.
aDouble
- the double value to be encodeddecodeDouble()
public abstract void encodeFloat(float aFloat)
decodeFloat
.
aFloat
- the float value to be encodeddecodeFloat()
public abstract void encodeInt(int anInt)
decodeInt
.
anInt
- the integer value to be encodeddecodeInt()
public abstract void encodeLong(long aLong)
decodeLong
.
aLong
- the long value to be encodeddecodeLong()
public abstract void encodeObject(Object object)
decodeObject
.
object
- the object to be encodeddecodeObject()
public abstract void encodeObjects(Object[] objects)
decodeObjects
.
objects
- the object array to be encodeddecodeObjects()
public abstract void encodeShort(short aShort)
decodeShort
.
aShort
- the short value to be encodeddecodeShort()
public void finishCoding()
public void prepareForReading(InputStream stream)
stream
.
NSCoder's default implementation does nothing.
stream
- the InputStream to read frompublic void prepareForWriting(OutputStream stream)
stream
.
NSCoder's default implementation does nothing.
stream
- the OutputStream to write to
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |