com.bea.wlpi.common
Class LongStrings

java.lang.Object
  |
  +--com.bea.wlpi.common.LongStrings

public class LongStrings
extends java.lang.Object

Supports serialization for strings, including those which exceed 64Kbytes in length when UTF-8 encoded. The class is required because pre-JDK1.3 VMs throw a UTFDataFormatException when attempting to serialize long strings.

Since:
WLPI version 1.2
Author:
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.

Method Summary
static java.lang.String decode(java.lang.Object o)
          Decode a previously encoded string.
static java.lang.Object encode(java.lang.String s)
          Encode a string so that it can be serialized.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decode

public static java.lang.String decode(java.lang.Object o)
Decode a previously encoded string. The string is assumed to have been encoded by encode(java.lang.String): the object o must therefore be null, a String[], or a String. If a String[], the method reconstitutes the original string by concatenating the elements of the array.

See Also:
encode(java.lang.String)

encode

public static java.lang.Object encode(java.lang.String s)
Encode a string so that it can be serialized. If the current Java VM is JDK 1.3 or later, or if the string would occupy less than 64 Kbytes when UTF-8 encoded, the method returns s unchanged. Otherwise, the method converts the string into a string array, each element of which will occcupy 64KBytes or less when UTF-8 encoded.
N.B. Once a long string has been encoded by this method under a JDK 1.3 VM then serialized, the resulting string cannot subsequently be deserialized by a pre-JDK 1.3 VM.

See Also:
decode(java.lang.Object)