Skip to content
Browse files

NEXUS-5372: Using buffered IO

Applied Igor's comments, using Buffered IO
that makes much sense, as we are tossing
around "records" of few bytes.
  • Loading branch information...
1 parent 334912b commit 141e9a4b0ed4250fe2a5bee9c895da19d4313025 @cstamas cstamas committed Nov 14, 2012
View
6 ...imeline-plugin/src/main/java/org/sonatype/timeline/internal/DefaultTimelinePersistor.java
@@ -12,6 +12,8 @@
*/
package org.sonatype.timeline.internal;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -100,7 +102,7 @@ protected synchronized void persist( final TimelineRecord... records )
OutputStream out = null;
try
{
- out = new FileOutputStream( getDataFile(), true );
+ out = new BufferedOutputStream( new FileOutputStream( getDataFile(), true ) );
for ( TimelineRecord record : records )
{
toProto( record ).writeDelimitedTo( out );
@@ -253,7 +255,7 @@ else if ( filePtr >= result.size() )
InputStream in = null;
try
{
- in = new FileInputStream( file );
+ in = new BufferedInputStream( new FileInputStream( file ) );
// V3 uses delimited format
TimelineRecord rec = fromProto( TimeLineRecordProtos.TimeLineRecord.parseDelimitedFrom( in ) );
while ( rec != null )

0 comments on commit 141e9a4

Please sign in to comment.
Something went wrong with that request. Please try again.