|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSCoder
public abstract class 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
,
NSCoder.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 void encodeBoolean(boolean aBoolean)
decodeBoolean
.
aBoolean
- the boolean value to be encodedNSCoder.decodeBoolean()
public abstract void encodeByte(byte aByte)
decodeByte
.
aByte
- the byte value to be encodedNSCoder.decodeByte()
public abstract void encodeBytes(byte[] bytes)
decodeBytes
.
bytes
- the byte array to be encodedNSCoder.decodeBytes()
public abstract void encodeChar(char aChar)
decodeChar
.
aChar
- the character value to be encodedNSCoder.decodeChar()
public abstract void encodeShort(short aShort)
decodeShort
.
aShort
- the short value to be encodedNSCoder.decodeShort()
public abstract void encodeInt(int anInt)
decodeInt
.
anInt
- the integer value to be encodedNSCoder.decodeInt()
public abstract void encodeLong(long aLong)
decodeLong
.
aLong
- the long value to be encodedNSCoder.decodeLong()
public abstract void encodeFloat(float aFloat)
decodeFloat
.
aFloat
- the float value to be encodedNSCoder.decodeFloat()
public abstract void encodeDouble(double aDouble)
decodeDouble
.
aDouble
- the double value to be encodedNSCoder.decodeDouble()
public abstract void encodeObject(Object object)
decodeObject
.
object
- the object to be encodedNSCoder.decodeObject()
public abstract void encodeClass(Class aClass)
decodeClass
.
aClass
- the class to be encodedNSCoder.decodeClass()
public abstract void encodeObjects(Object[] objects)
decodeObjects
.
objects
- the object array to be encodedNSCoder.decodeObjects()
public abstract boolean decodeBoolean()
encodeBoolean
.
NSCoder.encodeBoolean(boolean aBoolean)
public abstract byte decodeByte()
encodeByte
.
NSCoder.encodeByte(byte aByte)
public abstract byte[] decodeBytes()
encodeBytes
.
NSCoder.encodeBytes(byte[])
public abstract char decodeChar()
encodeChar
.
NSCoder.encodeChar(char aChar)
public abstract short decodeShort()
encodeShort
.
NSCoder.encodeShort(short aShort)
public abstract int decodeInt()
encodeInt
.
NSCoder.encodeInt(int anInt)
public abstract long decodeLong()
encodeLong
.
NSCoder.encodeLong(long aLong)
public abstract float decodeFloat()
encodeFloat
.
NSCoder.encodeFloat(float aFloat)
public abstract double decodeDouble()
encodeDouble
.
NSCoder.encodeDouble(double aDouble)
public abstract Object decodeObject()
encodeObject
.
NSCoder.encodeObject(Object object)
public abstract Class decodeClass()
encodeClass
.
NSCoder.encodeClass(Class aClass)
public abstract Object[] decodeObjects()
encodeObjects
.
NSCoder.encodeObjects(Object[] objects)
public void prepareForWriting(OutputStream stream)
stream
. NSCoder's default implementation does nothing.
stream
- the OutputStream to write topublic void prepareForReading(InputStream stream)
stream
. NSCoder's default implementation does nothing.
stream
- the InputStream to read frompublic void finishCoding()
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |