1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-12 02:10:30 +00:00

Merge pull request #253 from SquidDev-CC/hotfix/empty-files

Fix files not writing data when closed
This commit is contained in:
Daniel Ratcliffe 2017-05-17 19:35:26 +01:00 committed by GitHub
commit b86708aaf8
2 changed files with 12 additions and 4 deletions

View File

@ -23,7 +23,11 @@ public class EncodedInputHandle extends HandleGeneric
public EncodedInputHandle( InputStream stream, String encoding )
{
super( stream );
this( makeReader( stream, encoding ) );
}
private static BufferedReader makeReader( InputStream stream, String encoding )
{
if( encoding == null ) encoding = "UTF-8";
InputStreamReader streamReader;
try
@ -34,7 +38,7 @@ public class EncodedInputHandle extends HandleGeneric
{
streamReader = new InputStreamReader( stream );
}
this.m_reader = new BufferedReader( streamReader );
return new BufferedReader( streamReader );
}
@Nonnull

View File

@ -23,7 +23,11 @@ public class EncodedOutputHandle extends HandleGeneric
public EncodedOutputHandle( OutputStream stream, String encoding )
{
super( stream );
this( makeWriter( stream, encoding ) );
}
private static BufferedWriter makeWriter( OutputStream stream, String encoding )
{
if( encoding == null ) encoding = "UTF-8";
OutputStreamWriter streamWriter;
try
@ -34,7 +38,7 @@ public class EncodedOutputHandle extends HandleGeneric
{
streamWriter = new OutputStreamWriter( stream );
}
this.m_writer = new BufferedWriter( streamWriter );
return new BufferedWriter( streamWriter );
}
@Nonnull