@@ -45,6 +45,16 @@ class JsonStreamerEntity implements HttpEntity {
4545 private static final UnsupportedOperationException ERR_UNSUPPORTED =
4646 new UnsupportedOperationException ("Unsupported operation in this implementation." );
4747
48+ // Size of the byte-array buffer used to read from streams.
49+ private static final int BUFFER_SIZE = 2048 ;
50+
51+ // Reusable StringBuilder used by escape() method.
52+ // Base64, at worst, will make a binary stream grow in size by approximately
53+ // (n + 2 - ((n + 2) % 3)) / 3 * 4, which is roughly 1.3333333% for a
54+ // large 'n'.
55+ private static final StringBuilder BUILDER =
56+ new StringBuilder ((int )(BUFFER_SIZE * 1.35f ));
57+
4858 private static final byte [] JSON_TRUE = "true" .getBytes ();
4959 private static final byte [] JSON_FALSE = "false" .getBytes ();
5060 private static final byte [] STREAM_NAME = escape ("name" );
@@ -59,16 +69,6 @@ class JsonStreamerEntity implements HttpEntity {
5969 private static final String APPLICATION_OCTET_STREAM =
6070 "application/octet-stream" ;
6171
62- // Size of the byte-array buffer used to read from streams.
63- private static final int BUFFER_SIZE = 2048 ;
64-
65- // Reusable StringBuilder used by escape() method.
66- // Base64, at worst, will make a binary stream grow in size by approximately
67- // (n + 2 - ((n + 2) % 3)) / 3 * 4, which is roughly 1.3333333% for a
68- // large 'n'.
69- private static final StringBuilder BUILDER =
70- new StringBuilder ((int )(BUFFER_SIZE * 1.35f ));
71-
7272 // K/V objects to be uploaded.
7373 private final Map <String , Object > kvParams =
7474 new HashMap <String , Object >();
0 commit comments