Consistently applied appropriate ByteArrayOutputStream initial capacities across the codebase

Issue: SPR-11594
(cherry picked from commit dd7f54c)
This commit is contained in:
Juergen Hoeller
2014-03-25 00:35:33 +01:00
parent ab85aa2096
commit dbd5f67498
17 changed files with 101 additions and 97 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ final class PropertiesToStringConverter implements Converter<Properties, String>
public String convert(Properties source) {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
source.store(os, null);
return os.toString("ISO-8859-1");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class SerializingConverter implements Converter<Object, byte[]> {
* Serializes the source object and returns the byte array result.
*/
public byte[] convert(Object source) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(128);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(256);
try {
this.serializer.serialize(source, byteStream);
return byteStream.toByteArray();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,11 +36,11 @@ public class ToStringCreator {
new DefaultToStringStyler(StylerUtils.DEFAULT_VALUE_STYLER);
private StringBuilder buffer = new StringBuilder(512);
private final StringBuilder buffer = new StringBuilder(256);
private ToStringStyler styler;
private final ToStringStyler styler;
private Object object;
private final Object object;
private boolean styledFirstField;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public abstract class SerializationUtils {
if (object == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try {
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);