Skip to content

Commit 8f7a643

Browse files
author
Gary Gregory
committed
Sort new method.
1 parent 3c20580 commit 8f7a643

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -980,39 +980,6 @@ public static int copy(final InputStream inputStream, final OutputStream outputS
980980
return (int) count;
981981
}
982982

983-
/**
984-
* Copies bytes from a {@link java.io.ByteArrayOutputStream} to a {@code QueueInputStream}.
985-
* <p>
986-
* Unlike using JDK {@link java.io.PipedInputStream} and {@link java.io.PipedOutputStream} for this, this
987-
* solution works safely in a single thread environment.
988-
* </p>
989-
* <p>
990-
* Example usage:
991-
* </p>
992-
*
993-
* <pre>
994-
* ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
995-
* outputStream.writeBytes("hello world".getBytes(StandardCharsets.UTF_8));
996-
*
997-
* InputStream inputStream = IOUtils.copy(outputStream);
998-
* </pre>
999-
*
1000-
* @param outputStream the {@link java.io.ByteArrayOutputStream} to read.
1001-
* @return the {@code QueueInputStream} filled with the content of the outputStream.
1002-
* @throws NullPointerException if the {@link java.io.ByteArrayOutputStream} is {@code null}.
1003-
* @throws IOException if an I/O error occurs.
1004-
* @since 2.12
1005-
*/
1006-
@SuppressWarnings("resource") // streams are closed by the caller.
1007-
public static QueueInputStream copy(final java.io.ByteArrayOutputStream outputStream) throws IOException {
1008-
Objects.requireNonNull(outputStream, "outputStream");
1009-
1010-
final QueueInputStream in = new QueueInputStream();
1011-
outputStream.writeTo(in.newQueueOutputStream());
1012-
1013-
return in;
1014-
}
1015-
1016983
/**
1017984
* Copies bytes from an {@code InputStream} to an {@code OutputStream} using an internal buffer of the
1018985
* given size.
@@ -1112,6 +1079,39 @@ public static void copy(final InputStream input, final Writer writer, final Stri
11121079
copy(input, writer, Charsets.toCharset(inputCharsetName));
11131080
}
11141081

1082+
/**
1083+
* Copies bytes from a {@link java.io.ByteArrayOutputStream} to a {@code QueueInputStream}.
1084+
* <p>
1085+
* Unlike using JDK {@link java.io.PipedInputStream} and {@link java.io.PipedOutputStream} for this, this
1086+
* solution works safely in a single thread environment.
1087+
* </p>
1088+
* <p>
1089+
* Example usage:
1090+
* </p>
1091+
*
1092+
* <pre>
1093+
* ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
1094+
* outputStream.writeBytes("hello world".getBytes(StandardCharsets.UTF_8));
1095+
*
1096+
* InputStream inputStream = IOUtils.copy(outputStream);
1097+
* </pre>
1098+
*
1099+
* @param outputStream the {@link java.io.ByteArrayOutputStream} to read.
1100+
* @return the {@code QueueInputStream} filled with the content of the outputStream.
1101+
* @throws NullPointerException if the {@link java.io.ByteArrayOutputStream} is {@code null}.
1102+
* @throws IOException if an I/O error occurs.
1103+
* @since 2.12
1104+
*/
1105+
@SuppressWarnings("resource") // streams are closed by the caller.
1106+
public static QueueInputStream copy(final java.io.ByteArrayOutputStream outputStream) throws IOException {
1107+
Objects.requireNonNull(outputStream, "outputStream");
1108+
1109+
final QueueInputStream in = new QueueInputStream();
1110+
outputStream.writeTo(in.newQueueOutputStream());
1111+
1112+
return in;
1113+
}
1114+
11151115
/**
11161116
* Copies chars from a {@code Reader} to a {@code Appendable}.
11171117
* <p>

0 commit comments

Comments
 (0)