org.apache.commons.lang
クラス SerializationUtils

java.lang.Object
  拡張org.apache.commons.lang.SerializationUtils

public class SerializationUtils
extends Object

シリアライゼーション(直列化)の処理の補助または機能の追加を行うメソッド郡です。

Methods that assist with the serialization process, or perform additional functionality based on serialization.

バージョン:
$Id: SerializationUtils.java,v 1.1.1.1 2004/02/13 10:02:04 hioki Exp $
作成者:
Nissim Karpenstein, Janek Bogucki, Daniel Rall, Stephen Colebourne
翻訳者:
日置 聡
翻訳状況:
初稿(校正者募集中)
翻訳更新日:
2003/08/12

コンストラクタの概要
private SerializationUtils()
          SerializationUtils のコンストラクタは private です。
 
メソッドの概要
static Object clone(Serializable object)
          シリアライゼーションを使用したディープクローンを行います。
static Object deserialize(byte[] objectData)
          Deserializes a single object from an array of bytes.
static Object deserialize(InputStream inputStream)
          指定されたストリームからオブジェクトをディシリアライズします。
static byte[] serialize(Serializable obj)
          オブジェクトをシリアライズし、バイトの配列に格納します。
static void serialize(Serializable obj, OutputStream outputStream)
          オブジェクトを指定されたストリームに対してシリアライズします。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

SerializationUtils

private SerializationUtils()
SerializationUtils のコンストラクタは private です。
Constructor for SerializationUtils is private

メソッドの詳細

clone

public static Object clone(Serializable object)
シリアライゼーションを使用したディープクローンを行います。
Deep clone an object using serialization.

このメソッドは各オブジェクトが実装する clone メソッドよりも処理に時間を要します。 しかしディープクローンを実装していない構造の複雑なオブジェクトに対するシンプルな代用として使用することができます。 もちろん全てのオブジェクトは Serializable である必要があります。

This is many times slower than writing clone methods by hand on all objects in your object graph. However, for complex object graphs, or for those that don't support deep cloning this can be a simple alternative implementation. Of course all the objects must be Serializable.

パラメータ:
object - クローンの対象となる Serializable オブジェクト
the Serializable object to clone
戻り値:
クローンされたオブジェクト
the cloned object
例外:
SerializationException - 実行時にシリアライズに失敗した場合
(runtime) if the serialization fails

serialize

public static void serialize(Serializable obj,
                             OutputStream outputStream)
オブジェクトを指定されたストリームに対してシリアライズします。 このストリームはオブジェクトが書き出された後一旦クローズされます。 これによってアプリケーション内での finally 句、例外のハンドリングの実装を行う必要がなくなります。
Serializes an object to the specified stream. The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also exception handling, in the application code.

パラメータ:
obj - バイトにシリアライズするオブジェクト
the object to serialize to bytes
outputStream - 出力先となるストリーム
the stream to write to
例外:
SerializationException - 実行時にシリアライズに失敗した場合
(runtime) if the serialization fails

serialize

public static byte[] serialize(Serializable obj)
オブジェクトをシリアライズし、バイトの配列に格納します。
Serializes an object to a byte array for storage/serialization.

パラメータ:
obj - バイトにシリアライズするオブジェクト
the object to serialize to bytes
戻り値:
a byte[] with the converted Serializable
例外:
SerializationException - 実行時にシリアライズに失敗した場合
(runtime) if the serialization fails

deserialize

public static Object deserialize(InputStream inputStream)
指定されたストリームからオブジェクトをディシリアライズします。 このストリームはオブジェクトが復元された後一旦クローズされます。 これによってアプリケーション内での finally 句、例外のハンドリングの実装を行う必要がなくなります。
Deserializes an object from the specified stream. The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also exception handling, in the application code.

パラメータ:
inputStream - シリアライズされたオブジェクトの入力ストリーム
the serialized object input stream
戻り値:
ディシリアライズされたオブジェクト
例外:
SerializationException - 実行時にシリアライズに失敗した場合
(runtime) if the serialization fails

deserialize

public static Object deserialize(byte[] objectData)
Deserializes a single object from an array of bytes.
Deserializes a single object from an array of bytes.

パラメータ:
objectData - シリアライズされたオブジェクト
the serialized object
戻り値:
ディシリアライズされたオブジェクト
the deserialized object
例外:
SerializationException - 実行時にシリアライズに失敗した場合
(runtime) if the serialization fails


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation