A DESCRIPTION OF THE REQUEST :
I feel that both byte and character stream copy should be included in the standard API
JUSTIFICATION :
This is a wheel I'm constantly re-inventing, and, as far as I can see, a pretty easy hole to fill.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would suggest you consider adding
int write(InputStream is) throws IOException;
Method to OutputStream and
int write(Reader r) throws IOException;
to Writer (both returning number of elements copied).
A generic copy method could be placed in the abstract classes, potentially with more optimal copies in derived classes (e.g. Buffered versions).
ACTUAL -
DIY, Of course it's only a few lines, but it's one of those things that get's done different ways all the time.
I feel that both byte and character stream copy should be included in the standard API
JUSTIFICATION :
This is a wheel I'm constantly re-inventing, and, as far as I can see, a pretty easy hole to fill.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would suggest you consider adding
int write(InputStream is) throws IOException;
Method to OutputStream and
int write(Reader r) throws IOException;
to Writer (both returning number of elements copied).
A generic copy method could be placed in the abstract classes, potentially with more optimal copies in derived classes (e.g. Buffered versions).
ACTUAL -
DIY, Of course it's only a few lines, but it's one of those things that get's done different ways all the time.
- duplicates
-
JDK-8066867 Add InputStream transferTo to transfer content to an OutputStream
-
- Resolved
-