24
24
import java .io .PrintWriter ;
25
25
import java .io .Reader ;
26
26
import java .io .StringWriter ;
27
+ import java .io .Writer ;
27
28
import java .util .ArrayList ;
28
29
import java .util .Collection ;
29
30
import java .util .Enumeration ;
@@ -299,12 +300,12 @@ public void addValue( String value )
299
300
}
300
301
301
302
/**
302
- * Write the attribute out to a print writer.
303
+ * Writes the attribute out to a writer.
303
304
*
304
305
* @param writer the Writer to which the attribute is written
305
306
* @throws IOException if the attribute value cannot be written
306
307
*/
307
- void write ( PrintWriter writer )
308
+ void write ( Writer writer )
308
309
throws IOException
309
310
{
310
311
StringWriter sWriter = new StringWriter ();
@@ -317,7 +318,7 @@ void write( PrintWriter writer )
317
318
318
319
byte [] convertedToUtf8 = sWriter .toString ().getBytes ( "UTF-8" );
319
320
320
- writer .print ( new String ( convertedToUtf8 , "UTF-8" ) );
321
+ writer .write ( new String ( convertedToUtf8 , "UTF-8" ) );
321
322
}
322
323
323
324
/**
@@ -327,7 +328,7 @@ void write( PrintWriter writer )
327
328
* @param value the attribute value
328
329
* @throws IOException if the attribute value cannot be written
329
330
*/
330
- private void writeValue ( PrintWriter writer , String value )
331
+ private void writeValue ( Writer writer , String value )
331
332
throws IOException
332
333
{
333
334
String nameValue = name + ": " + value ;
@@ -350,7 +351,7 @@ private void writeValue( PrintWriter writer, String value )
350
351
* @param line the manifest line to be written
351
352
* @throws java.io.IOException when Io excepts
352
353
*/
353
- private void writeLine ( PrintWriter writer , String line )
354
+ private void writeLine ( Writer writer , String line )
354
355
throws IOException
355
356
{
356
357
while ( line .getBytes ().length > MAX_LINE_LENGTH )
@@ -367,10 +368,10 @@ private void writeLine( PrintWriter writer, String line )
367
368
{
368
369
throw new IOException ( "Unable to write manifest line " + line );
369
370
}
370
- writer .print ( section + EOL );
371
+ writer .write ( section + EOL );
371
372
line = " " + line .substring ( breakIndex );
372
373
}
373
- writer .print ( line + EOL );
374
+ writer .write ( line + EOL );
374
375
}
375
376
}
376
377
@@ -417,7 +418,7 @@ public void addValue( String value )
417
418
setValue ( value1 );
418
419
}
419
420
420
- void write ( PrintWriter writer )
421
+ void write ( Writer writer )
421
422
throws IOException
422
423
{
423
424
throw new UnsupportedOperationException ( "Cant do this" );
@@ -845,12 +846,12 @@ public void addConfiguredAttribute( Attribute attribute )
845
846
}
846
847
847
848
/**
848
- * Write the manifest out to a print writer.
849
+ * Writes the manifest out to a writer.
849
850
*
850
851
* @param writer the Writer to which the manifest is written
851
852
* @throws IOException if the manifest cannot be written
852
853
*/
853
- public void write ( PrintWriter writer )
854
+ public void write ( Writer writer )
854
855
throws IOException
855
856
{
856
857
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ();
@@ -872,7 +873,7 @@ public String toString()
872
873
StringWriter sw = new StringWriter ();
873
874
try
874
875
{
875
- write ( new PrintWriter ( sw ) );
876
+ write ( sw );
876
877
}
877
878
catch ( IOException e )
878
879
{
0 commit comments