File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
msgpack-core/src/main/java/org/msgpack/core Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -153,10 +153,7 @@ public void flush()
153153 throws IOException
154154 {
155155 if (position > 0 ) {
156- out .writeBuffer (position );
157- buffer = null ;
158- totalFlushBytes += position ;
159- position = 0 ;
156+ flushBuffer ();
160157 }
161158 out .flush ();
162159 }
@@ -172,17 +169,23 @@ public void close()
172169 }
173170 }
174171
172+ private void flushBuffer ()
173+ throws IOException
174+ {
175+ out .writeBuffer (position );
176+ buffer = null ;
177+ totalFlushBytes += position ;
178+ position = 0 ;
179+ }
180+
175181 private void ensureCapacity (int mimimumSize )
176182 throws IOException
177183 {
178184 if (buffer == null ) {
179185 buffer = out .next (mimimumSize );
180186 }
181187 else if (position + mimimumSize >= buffer .size ()) {
182- out .writeBuffer (position );
183- buffer = null ;
184- totalFlushBytes += position ;
185- position = 0 ;
188+ flushBuffer ();
186189 buffer = out .next (mimimumSize );
187190 }
188191 }
You can’t perform that action at this time.
0 commit comments