< prev index next >

test/java/io/Serializable/longString/LongString.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4217676
  26  * @summary Ensure that object streams support serialization of long strings
  27  *          (strings whose UTF representation > 64k in length)

  28  */
  29 
  30 import java.io.*;
  31 import java.util.*;
  32 
  33 public class LongString {
  34     public static void main(String[] args) throws Exception {
  35         Random rand = new Random(System.currentTimeMillis());
  36         ByteArrayOutputStream bout;
  37         ByteArrayInputStream bin;
  38         ObjectOutputStream oout;
  39         ObjectInputStream oin;
  40         FileInputStream fin;
  41         File mesgf;
  42 
  43         // generate a long random string
  44         StringBuffer sbuf = new StringBuffer();
  45         for (int i = 0; i < 100000; i++)
  46             sbuf.append((char) rand.nextInt(Character.MAX_VALUE + 1));
  47         String str = sbuf.toString();




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4217676
  26  * @summary Ensure that object streams support serialization of long strings
  27  *          (strings whose UTF representation > 64k in length)
  28  * @key randomness
  29  */
  30 
  31 import java.io.*;
  32 import java.util.*;
  33 
  34 public class LongString {
  35     public static void main(String[] args) throws Exception {
  36         Random rand = new Random(System.currentTimeMillis());
  37         ByteArrayOutputStream bout;
  38         ByteArrayInputStream bin;
  39         ObjectOutputStream oout;
  40         ObjectInputStream oin;
  41         FileInputStream fin;
  42         File mesgf;
  43 
  44         // generate a long random string
  45         StringBuffer sbuf = new StringBuffer();
  46         for (int i = 0; i < 100000; i++)
  47             sbuf.append((char) rand.nextInt(Character.MAX_VALUE + 1));
  48         String str = sbuf.toString();


< prev index next >