Skip to content

Commit 3a85942

Browse files
committed
java.io.OutputStreamWriter utilizes java.lang.CharSequence.getChars
1 parent 57070b7 commit 3a85942

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/java.base/share/classes/java/io/OutputStreamWriter.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -224,22 +224,21 @@ public void write(String str, int off, int len) throws IOException {
224224
se.write(str, off, len);
225225
}
226226

227-
@Override
228-
public Writer append(CharSequence csq, int start, int end) throws IOException {
229-
if (csq == null) csq = "null";
230-
return append(csq.subSequence(start, end));
231-
}
232-
233227
@Override
234228
public Writer append(CharSequence csq) throws IOException {
235229
if (csq instanceof CharBuffer) {
236230
se.write((CharBuffer) csq);
237231
} else {
238-
se.write(String.valueOf(csq));
232+
super.append(csq);
239233
}
240234
return this;
241235
}
242236

237+
@Override
238+
void implWrite(CharSequence csq, int start, int end) throws IOException {
239+
se.append(csq, start, end);
240+
}
241+
243242
/**
244243
* Flushes the stream.
245244
*

0 commit comments

Comments
 (0)