SerializeInputStream (class)
public SerializeInputStream {inherits {InputStream-of any}, {PeekableInputStream-of any}}
Package: CURL.IO.SERIALIZE

An input stream which deserializes from a byte stream.


Constructors
default:Create an input stream for deserialization.
constructor public {SerializeInputStream.default
    raw-byte-stream:ByteInputStream,
    close-stream-on-close?:bool = true,
    manifest:#ComponentManifest = null,
    known-values:#FastArray = null
}
Properties
known-values:Set of known values
accessor public inline SerializeInputStream.known-values:#FastArray
manifest:The manifest associated with the stream.
accessor public inline SerializeInputStream.manifest:ComponentManifest
open?:Indicate if this Stream is currently open, should return false once Stream-of.close has been called.
accessor public SerializeInputStream.open?:bool
origin-url:Returns the Url that this stream was opened from, or null, if no such Url exists.
accessor public SerializeInputStream.origin-url:#Url
protocol:Serialization protocol used by this stream.
accessor public inline SerializeInputStream.protocol:SerializeProtocol
raw-byte-stream:Gets a raw byte stream for customized deserialization.
accessor public SerializeInputStream.raw-byte-stream:ByteInputStream
Properties inherited from PeekableInputStream-of: end-of-stream?
Properties inherited from Stream-of: non-blocking-supported?
Properties inherited from GenericInputStream: when-last-modified
Methods
close:Close Stream, should make stream un-usable and make sure that Stream-of.open? return false once this has been called.
public {SerializeInputStream.close}:void
copy-out:Deserializes multiple values from stream into another stream.
public {SerializeInputStream.copy-out
    out:{OutputStream-of any},
    n:int64 = max-int64
}:int64
import-package:Returns the package given name and location information.
public {SerializeInputStream.import-package
    name:#String,
    locator:#String
}:Package
next-one:Like read-one, but throws EndOfStreamException if the end of stream has been reached.
public {SerializeInputStream.next-one}:any
package-lookup:Returns the object represented by the name in the given package.
public {SerializeInputStream.package-lookup
    package:Package,
    name:String
}:any
peek-one:Deserializes next element without removing from stream.
public {SerializeInputStream.peek-one}:(any, bool)
read:Deserializes multiple values from stream.
public {SerializeInputStream.read
    out:#Array = null,
    start:int = 0,
    n:int = max-int - start,
    allow-short-read?:bool = false,
    non-blocking?:bool = false
}:(vals:Array, number-read:int)
read-anys:Deserializes multiple values from stream.
public {SerializeInputStream.read-anys
    out:#Array = null,
    start:int = 0,
    n:int = max-int - start,
    allow-short-read?:bool = false,
    non-blocking?:bool = false
}:(vals:Array, n:int)
read-class-version:Reads a version number for the class being deserialized.
public {SerializeInputStream.read-class-version}:int
read-one:Deserializes next element from stream.
public {SerializeInputStream.read-one}:(any, bool)
read-one-compact:Read value using compact representation.
public {SerializeInputStream.read-one-compact
    compile-time-type:Type
}:any
reopen:Reopen this stream.
public {SerializeInputStream.reopen
    raw-byte-stream:ByteInputStream,
    close-stream-on-close?:bool = true,
    manifest:ComponentManifest = self.manifest,
    known-values:#FastArray = self.known-values
}:void
to-Iterator:Returns a deserializing iterator.
public {SerializeInputStream.to-Iterator}:{Iterator-of any}
verify-class-version:Read a version number for the class being deserialized, and verify that it has the expected value.
public {SerializeInputStream.verify-class-version version:int}:void
Methods inherited from InputStream-of: async-read, read-one-any
Methods inherited from PeekableInputStream-of: peek-one-any
Methods inherited from Stream-of: verify-open
Methods inherited from Object: object-describe, object-describe-for-debugging, object-serialize

Constructor Details
default (constructor)
public {SerializeInputStream.default
    raw-byte-stream:ByteInputStream,
    close-stream-on-close?:bool = true,
    manifest:#ComponentManifest = null,
    known-values:#FastArray = null
}

Create an input stream for deserialization.

raw-byte-stream: The byte stream from which the serialized objects will be read.
close-stream-on-close?: If true (the default), then the byte stream raw-byte-stream will be closed when this stream is closed.
manifest: The manifest used to find deserialized packages, defaulting to the applet's manifest. Usually the default is sufficient, but in cases involving incomplete manifest delegation it may be necessary to pass {get-default-manifest} to force the use of the manifest of the package creating this object.
known-values: specifies an optional list of known values. It must be identical to the one used to serialize the data (see SerializeOutputStream.known-values).

Notes

A ByteInputStream can be created from a ByteArray by using the ByteArrayInputStream class.


Property Details
known-values (accessor)
accessor public inline SerializeInputStream.known-values:#FastArray

Set of known values

Description

This is the known-values array that was last given to the default constructor or reopen method.
Introduced in: version 6.0


manifest (accessor)
accessor public inline SerializeInputStream.manifest:ComponentManifest

The manifest associated with the stream.

Description

The ComponentManifest that was used to initialize the stream either in the default constructor or the reopen method.
Introduced in: version 6.0


open? (accessor)
accessor public SerializeInputStream.open?:bool

Indicate if this Stream is currently open, should return false once Stream-of.close has been called.

Notes

Used by default implementations in InputStream-of and OutputStream-of to error out from many operations if stream is not open.

Overriding

Subclasses must provide this.


origin-url (accessor)
accessor public SerializeInputStream.origin-url:#Url

Returns the Url that this stream was opened from, or null, if no such Url exists.

Example

{read-open {url "file://c:/foo.txt"}}.origin-url would return the Url file://c:/foo.txt (assuming such a file exists).

On the other hand, {{TextInputStream-from String} "foo"}.origin-url would return null.


protocol (accessor)
accessor public inline SerializeInputStream.protocol:SerializeProtocol

Serialization protocol used by this stream.

Description

This is read from the stream itself.
Introduced in: version 6.0


raw-byte-stream (accessor)
accessor public SerializeInputStream.raw-byte-stream:ByteInputStream

Gets a raw byte stream for customized deserialization.



Method Details
close (method)
public {SerializeInputStream.close}:void

Close Stream, should make stream un-usable and make sure that Stream-of.open? return false once this has been called.



copy-out (method)
public {SerializeInputStream.copy-out
    out:{OutputStream-of any},
    n:int64 = max-int64
}:int64

Deserializes multiple values from stream into another stream.

Description

This may only be used when all the values satisfy the conditions allowing them to be read using read-one. See that method for details.

See InputStream-of.copy-out for details on the parameters.


import-package (method)
public {SerializeInputStream.import-package
    name:#String,
    locator:#String
}:Package

Returns the package given name and location information.

name: The name of the package. If null, the applet's package will be returned.
locator: Information that was provided during serialization by SerializeOutputStream.get-package-locator to help locate the package.

Returns

Returns a package.

Description

This is invoked internally when deserializing packages. It is not intended to be invoked directly.

The default implementation will import the package by name, ignoring the locator.

To implement different behavior, you must override this method and SerializeOutputStream.get-package-locator in subclasses.


next-one (method)
public {SerializeInputStream.next-one}:any

Like read-one, but throws EndOfStreamException if the end of stream has been reached.



package-lookup (method)
public {SerializeInputStream.package-lookup
    package:Package,
    name:String
}:any

Returns the object represented by the name in the given package.

package: The package associated with the name.
name: The name provided to be looked up in the package.

Returns

Returns the value in the package associated with the name.

Description

The default serialization will lookup the name in the package using Package.lookup. Overriding this method is the only way to handle named types, other than classes, that have changed in an incompatible way.


peek-one (method)
public {SerializeInputStream.peek-one}:(any, bool)

Deserializes next element without removing from stream.

Description

Second argument indicates whether the end of stream has been reached, in which case the first argument will be null.

The next call to read-one will return the same values.

Note that this may only be used when it is safe to use read-one. See that method for details.

Also see peek-one.


read (method)
public {SerializeInputStream.read
    out:#Array = null,
    start:int = 0,
    n:int = max-int - start,
    allow-short-read?:bool = false,
    non-blocking?:bool = false
}:(vals:Array, number-read:int)

Deserializes multiple values from stream.

Description

This may only be used when all the values satisfy the conditions allowing them to be read using read-one. See that method for details.

See InputStream-of.read for details on the parameters.


read-anys (method)
public {SerializeInputStream.read-anys
    out:#Array = null,
    start:int = 0,
    n:int = max-int - start,
    allow-short-read?:bool = false,
    non-blocking?:bool = false
}:(vals:Array, n:int)

Deserializes multiple values from stream.

Description

This is the same as read.


read-class-version (method)
public {SerializeInputStream.read-class-version}:int

Reads a version number for the class being deserialized.

Returns

Returns the version for the class written during serialization.

Description

This version can be compared to the current version of the class during deserialization.


read-one (method)
public {SerializeInputStream.read-one}:(any, bool)

Deserializes next element from stream.

Description

Second argument indicates whether the end of stream has been reached, in which case the first argument will be null.

This should not be used to read values that were not written using SerializeOutputStream.write-one or write-one-compact, and will only work with the latter if SerializeProtocol version-4-0 is being used or if the value is a proc or a regular class instance (i.e., subtypes of Object).

Also see read-one.


read-one-compact (method)
public {SerializeInputStream.read-one-compact
    compile-time-type:Type
}:any

Read value using compact representation.

compile-time-type: is a supertype of the expected value and is the type that was used to write the variable using SerializeOutputStream.write-one-compact.

When SerializeInputStream.protocol is set to version-4-0 then this is the same as read-one.
Introduced in: version 6.0


reopen (method)
public {SerializeInputStream.reopen
    raw-byte-stream:ByteInputStream,
    close-stream-on-close?:bool = true,
    manifest:ComponentManifest = self.manifest,
    known-values:#FastArray = self.known-values
}:void

Reopen this stream.

Description

Allows the stream to be reused after it has been closed.

The arguments are the same as used for the default constructor and this is semantically equivalent to constructing a new stream with the given arguments.

Both manifest and known-values will default to their existing values.


to-Iterator (method)
public {SerializeInputStream.to-Iterator}:{Iterator-of any}

Returns a deserializing iterator.

Description

This returns an iterator that uses read-one to read values from the stream. See that method for details and restrictions.


verify-class-version (method)
public {SerializeInputStream.verify-class-version version:int}:void

Read a version number for the class being deserialized, and verify that it has the expected value.

version: The version that must match the object being deserialized.

Description

Will throw a SerializeException if the version does not match.