org.jboss.messaging.util
Class SafeUTF

java.lang.Object
  extended byorg.jboss.messaging.util.SafeUTF

public class SafeUTF
extends java.lang.Object

A SafeUTF

Version:
$Revision: 1174 $ $Id: SafeUTF.java 1174 2006-08-02 14:14:32Z timfox $ There is a "bug" in JDK1.4 / 1.5 DataOutputStream.writeUTF() which means it does not work with Strings >= 64K serialized size. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4806007 We work around this by chunking larger strings into smaller pieces. Note we only support TextMessage and ObjectMessage bodies with serialized length >= 64K We DO NOT support Strings written to BytesMessages or StreamMessages or written as keys or values in MapMessages, or as String properties or other String fields having serialized length >= 64K This is for performance reasons since there is an overhead in coping with large Strings
Author:
Tim Fox, Adrian Brock

Field Summary
static SafeUTF instance
           
 
Constructor Summary
SafeUTF(int chunkSize)
           
 
Method Summary
 int getLastReadBufferSize()
           
 java.lang.String safeReadUTF(java.io.DataInputStream in)
           
 void safeWriteUTF(java.io.DataOutputStream out, java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static SafeUTF instance
Constructor Detail

SafeUTF

public SafeUTF(int chunkSize)
Method Detail

getLastReadBufferSize

public int getLastReadBufferSize()

safeWriteUTF

public void safeWriteUTF(java.io.DataOutputStream out,
                         java.lang.String str)
                  throws java.io.IOException
Throws:
java.io.IOException

safeReadUTF

public java.lang.String safeReadUTF(java.io.DataInputStream in)
                             throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2006 JBoss Inc. All Rights Reserved.