mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-12 10:20:28 +00:00
Merge pull request #253 from SquidDev-CC/hotfix/empty-files
Fix files not writing data when closed
This commit is contained in:
commit
b86708aaf8
@ -23,7 +23,11 @@ public class EncodedInputHandle extends HandleGeneric
|
|||||||
|
|
||||||
public EncodedInputHandle( InputStream stream, String encoding )
|
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";
|
if( encoding == null ) encoding = "UTF-8";
|
||||||
InputStreamReader streamReader;
|
InputStreamReader streamReader;
|
||||||
try
|
try
|
||||||
@ -34,7 +38,7 @@ public class EncodedInputHandle extends HandleGeneric
|
|||||||
{
|
{
|
||||||
streamReader = new InputStreamReader( stream );
|
streamReader = new InputStreamReader( stream );
|
||||||
}
|
}
|
||||||
this.m_reader = new BufferedReader( streamReader );
|
return new BufferedReader( streamReader );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -23,7 +23,11 @@ public class EncodedOutputHandle extends HandleGeneric
|
|||||||
|
|
||||||
public EncodedOutputHandle( OutputStream stream, String encoding )
|
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";
|
if( encoding == null ) encoding = "UTF-8";
|
||||||
OutputStreamWriter streamWriter;
|
OutputStreamWriter streamWriter;
|
||||||
try
|
try
|
||||||
@ -34,7 +38,7 @@ public class EncodedOutputHandle extends HandleGeneric
|
|||||||
{
|
{
|
||||||
streamWriter = new OutputStreamWriter( stream );
|
streamWriter = new OutputStreamWriter( stream );
|
||||||
}
|
}
|
||||||
this.m_writer = new BufferedWriter( streamWriter );
|
return new BufferedWriter( streamWriter );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
Loading…
Reference in New Issue
Block a user