2424import java .io .PrintWriter ;
2525import java .io .Reader ;
2626import java .io .StringWriter ;
27+ import java .io .Writer ;
2728import java .util .ArrayList ;
2829import java .util .Collection ;
2930import java .util .Enumeration ;
@@ -299,12 +300,12 @@ public void addValue( String value )
299300 }
300301
301302 /**
302- * Write the attribute out to a print writer.
303+ * Writes the attribute out to a writer.
303304 *
304305 * @param writer the Writer to which the attribute is written
305306 * @throws IOException if the attribute value cannot be written
306307 */
307- void write ( PrintWriter writer )
308+ void write ( Writer writer )
308309 throws IOException
309310 {
310311 StringWriter sWriter = new StringWriter ();
@@ -317,7 +318,7 @@ void write( PrintWriter writer )
317318
318319 byte [] convertedToUtf8 = sWriter .toString ().getBytes ( "UTF-8" );
319320
320- writer .print ( new String ( convertedToUtf8 , "UTF-8" ) );
321+ writer .write ( new String ( convertedToUtf8 , "UTF-8" ) );
321322 }
322323
323324 /**
@@ -327,7 +328,7 @@ void write( PrintWriter writer )
327328 * @param value the attribute value
328329 * @throws IOException if the attribute value cannot be written
329330 */
330- private void writeValue ( PrintWriter writer , String value )
331+ private void writeValue ( Writer writer , String value )
331332 throws IOException
332333 {
333334 String nameValue = name + ": " + value ;
@@ -350,7 +351,7 @@ private void writeValue( PrintWriter writer, String value )
350351 * @param line the manifest line to be written
351352 * @throws java.io.IOException when Io excepts
352353 */
353- private void writeLine ( PrintWriter writer , String line )
354+ private void writeLine ( Writer writer , String line )
354355 throws IOException
355356 {
356357 while ( line .getBytes ().length > MAX_LINE_LENGTH )
@@ -367,10 +368,10 @@ private void writeLine( PrintWriter writer, String line )
367368 {
368369 throw new IOException ( "Unable to write manifest line " + line );
369370 }
370- writer .print ( section + EOL );
371+ writer .write ( section + EOL );
371372 line = " " + line .substring ( breakIndex );
372373 }
373- writer .print ( line + EOL );
374+ writer .write ( line + EOL );
374375 }
375376 }
376377
@@ -417,7 +418,7 @@ public void addValue( String value )
417418 setValue ( value1 );
418419 }
419420
420- void write ( PrintWriter writer )
421+ void write ( Writer writer )
421422 throws IOException
422423 {
423424 throw new UnsupportedOperationException ( "Cant do this" );
@@ -845,12 +846,12 @@ public void addConfiguredAttribute( Attribute attribute )
845846 }
846847
847848 /**
848- * Write the manifest out to a print writer.
849+ * Writes the manifest out to a writer.
849850 *
850851 * @param writer the Writer to which the manifest is written
851852 * @throws IOException if the manifest cannot be written
852853 */
853- public void write ( PrintWriter writer )
854+ public void write ( Writer writer )
854855 throws IOException
855856 {
856857 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ();
@@ -872,7 +873,7 @@ public String toString()
872873 StringWriter sw = new StringWriter ();
873874 try
874875 {
875- write ( new PrintWriter ( sw ) );
876+ write ( sw );
876877 }
877878 catch ( IOException e )
878879 {
0 commit comments