You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2020/11/12 20:09:58 UTC
[juneau] branch master updated: Remove unused/untested APIs.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 8ffdc92 Remove unused/untested APIs.
8ffdc92 is described below
commit 8ffdc92a9e0460eabefff1cc9c7bf20e62c7325b
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Thu Nov 12 15:09:52 2020 -0500
Remove unused/untested APIs.
---
.../juneau/http/header/BasicDateHeader_Test.java | 2 +-
.../java/org/apache/juneau/oapi/OpenApiTest.java | 1 -
.../apache/juneau/testutils}/CalendarUtils.java | 2 +-
.../org/apache/juneau/internal/ClassTreeSet.java | 47 ---
.../org/apache/juneau/internal/MappedIterable.java | 65 ----
.../apache/juneau/internal/TeeOutputStream.java | 133 -------
.../java/org/apache/juneau/internal/TeeWriter.java | 139 -------
.../apache/juneau/internal/WriterOutputStream.java | 340 -----------------
.../apache/juneau/serializer/WriterSerializer.java | 11 -
.../java/org/apache/juneau/utils/IdGenerator.java | 35 --
.../java/org/apache/juneau/utils/IdGenerators.java | 83 -----
.../main/java/org/apache/juneau/utils/IdMap.java | 106 ------
.../java/org/apache/juneau/utils/ProcBuilder.java | 411 ---------------------
.../org/apache/juneau/utils/StringMessage.java | 78 ----
.../java/org/apache/juneau/utils/StringObject.java | 98 -----
.../java/org/apache/juneau/utils/ZipFileList.java | 173 ---------
pom.xml | 1 -
17 files changed, 2 insertions(+), 1723 deletions(-)
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java
index 40942ad..f72cd6a 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java
@@ -24,7 +24,7 @@ import org.apache.juneau.internal.*;
import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.rest.client.*;
import org.apache.juneau.rest.mock.*;
-import org.apache.juneau.utils.*;
+import org.apache.juneau.testutils.*;
import static org.apache.juneau.assertions.Assertions.*;
import static org.apache.juneau.http.header.BasicDateHeader.*;
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java
index 982a794..23e6c38 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java
@@ -25,7 +25,6 @@ import org.apache.juneau.collections.*;
import org.apache.juneau.httppart.*;
import org.apache.juneau.marshall.*;
import org.apache.juneau.testutils.*;
-import org.apache.juneau.utils.*;
import org.junit.*;
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java
similarity index 99%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java
rename to juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java
index da1c152..bc0d7ea 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java
@@ -10,7 +10,7 @@
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
// * specific language governing permissions and limitations under the License. *
// ***************************************************************************************************************************
-package org.apache.juneau.utils;
+package org.apache.juneau.testutils;
import static org.apache.juneau.internal.DateUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java
deleted file mode 100644
index eca4e5a..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import java.util.*;
-
-/**
- * {@link TreeSet} for {@link Class} objects.
- */
-public class ClassTreeSet extends TreeSet<Class<?>> {
-
- private static final long serialVersionUID = 1L;
-
- private static final Comparator<Class<?>> COMPARATOR = new Comparator<Class<?>>() {
- @Override
- public int compare(Class<?> o1, Class<?> o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
- /**
- * Constructor.
- */
- public ClassTreeSet() {
- super(COMPARATOR);
- }
-
- /**
- * Constructor.
- *
- * @param c Initial contents of set.
- */
- public ClassTreeSet(Collection<Class<?>> c) {
- super(COMPARATOR);
- addAll(c);
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MappedIterable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MappedIterable.java
deleted file mode 100644
index e4e3dfb..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MappedIterable.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import java.util.*;
-import java.util.function.*;
-
-/**
- * Combines an {@link Iterable} with a {@link Function} so that you can map
- * entries while iterating over them.
- *
- * @param <I> The unmapped type.
- * @param <E> The mapped type.
- */
-public class MappedIterable<I,E> implements Iterable<E> {
-
- final Iterator<I> i;
- final Function<I,E> f;
-
- /**
- * Constructor.
- *
- * @param i The original iterable being wrapped.
- * @param f The function to use to convert from unmapped to mapped types.
- */
- protected MappedIterable(Iterable<I> i, Function<I,E> f) {
- this.i = i.iterator();
- this.f = f;
- }
-
- /**
- * Constructor.
- *
- * @param i The original iterable being wrapped.
- * @param f The function to use to convert from unmapped to mapped types.
- * @return A new iterable.
- */
- public static <I,E> Iterable<E> of(Iterable<I> i, Function<I,E> f) {
- return new MappedIterable<>(i, f);
- }
-
- @Override
- public Iterator<E> iterator() {
- return new Iterator<E>() {
- @Override
- public boolean hasNext() {
- return i.hasNext();
- }
- @Override
- public E next() {
- return f.apply(i.next());
- }
- };
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeOutputStream.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeOutputStream.java
deleted file mode 100644
index e2c7bc4..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeOutputStream.java
+++ /dev/null
@@ -1,133 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Output stream that can send output to multiple output streams.
- */
-public class TeeOutputStream extends OutputStream {
- private OutputStream[] outputStreams = new OutputStream[0];
- private Map<String,OutputStream> outputStreamMap;
-
- /**
- * Constructor.
- *
- * @param outputStreams The list of output streams.
- */
- public TeeOutputStream(OutputStream...outputStreams) {
- this.outputStreams = outputStreams;
- }
-
- /**
- * Constructor.
- *
- * @param outputStreams The list of output streams.
- */
- public TeeOutputStream(Collection<OutputStream> outputStreams) {
- this.outputStreams = outputStreams.toArray(new OutputStream[outputStreams.size()]);
- }
-
- /**
- * Adds an output stream to this tee output stream.
- *
- * @param os The output stream to add to this tee output stream.
- * @param close
- * If <jk>false</jk>, then calling {@link #close()} on this stream will not filter to the specified output stream.
- * @return This object (for method chaining).
- */
- public TeeOutputStream add(OutputStream os, boolean close) {
- if (os == null)
- return this;
- if (! close)
- os = new NoCloseOutputStream(os);
- if (os == this)
- throw new RuntimeException("Cannot add this output stream to itself.");
- for (OutputStream os2 : outputStreams)
- if (os2 == os)
- throw new RuntimeException("Cannot add this output stream again.");
- if (os instanceof TeeOutputStream) {
- for (OutputStream os2 : ((TeeOutputStream)os).outputStreams)
- add(os2, true);
- } else {
- outputStreams = ArrayUtils.append(outputStreams, os);
- }
- return this;
- }
-
- /**
- * Returns the output stream identified through the <c>id</c> parameter passed in through the
- * {@link #add(String, OutputStream, boolean)} method.
- *
- * @param id The ID associated with the output stream.
- * @return The output stream, or <jk>null</jk> if no identifier was specified when the output stream was added.
- */
- public OutputStream getOutputStream(String id) {
- if (outputStreamMap != null)
- return outputStreamMap.get(id);
- return null;
- }
-
- /**
- * Same as {@link #add(OutputStream, boolean)} but associates the stream with an identifier so the stream can be
- * retrieved through {@link #getOutputStream(String)}.
- *
- * @param id The ID to associate the output stream with.
- * @param os The output stream to add.
- * @param close Close the specified stream afterwards.
- * @return This object (for method chaining).
- */
- public TeeOutputStream add(String id, OutputStream os, boolean close) {
- if (id != null) {
- if (outputStreamMap == null)
- outputStreamMap = new TreeMap<>();
- outputStreamMap.put(id, os);
- }
- return add(os, close);
- }
-
- /**
- * Returns the number of inner streams in this tee stream.
- *
- * @return The number of streams in this tee stream.
- */
- public int size() {
- return outputStreams.length;
- }
-
- @Override /* OutputStream */
- public void write(int b) throws IOException {
- for (OutputStream os : outputStreams)
- os.write(b);
- }
-
- @Override /* OutputStream */
- public void write(byte b[], int off, int len) throws IOException {
- for (OutputStream os : outputStreams)
- os.write(b, off, len);
- }
-
- @Override /* OutputStream */
- public void flush() throws IOException {
- for (OutputStream os : outputStreams)
- os.flush();
- }
-
- @Override /* OutputStream */
- public void close() throws IOException {
- for (OutputStream os : outputStreams)
- os.close();
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeWriter.java
deleted file mode 100644
index e7631cf..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/TeeWriter.java
+++ /dev/null
@@ -1,139 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Writer that can send output to multiple writers.
- */
-public class TeeWriter extends Writer {
- private Writer[] writers = new Writer[0];
- private Map<String,Writer> writerMap;
-
- /**
- * Constructor.
- *
- * @param writers The list of writers.
- */
- public TeeWriter(Writer...writers) {
- this.writers = writers;
- }
-
- /**
- * Constructor.
- *
- * @param writers The list of writers.
- */
- public TeeWriter(Collection<Writer> writers) {
- this.writers = writers.toArray(new Writer[writers.size()]);
- }
-
- /**
- * Adds a writer to this tee writer.
- *
- * @param w The writer to add to this tee writer.
- * @param close
- * If <jk>false</jk>, then calling {@link #close()} on this tee writer will not filter to the specified writer.
- * @return This object (for method chaining).
- */
- public TeeWriter add(Writer w, boolean close) {
- if (w == null)
- return this;
- if (! close)
- w = new NoCloseWriter(w);
- if (w == this)
- throw new RuntimeException("Cannot add this writer to itself.");
- for (Writer w2 : writers)
- if (w2 == w)
- throw new RuntimeException("Cannot add this writer again.");
- if (w instanceof TeeWriter) {
- for (Writer w2 : ((TeeWriter)w).writers)
- add(w2, true);
- } else {
- writers = ArrayUtils.append(writers, w);
- }
- return this;
- }
-
- /**
- * Same as {@link #add(Writer, boolean)} but associates the writer with an identifier so the writer can be retrieved
- * through {@link #getWriter(String)}.
- *
- * @param id The ID to associate the writer with.
- * @param w The writer to add.
- * @param close Close the specified writer afterwards.
- * @return This object (for method chaining).
- */
- public TeeWriter add(String id, Writer w, boolean close) {
- if (id != null) {
- if (writerMap == null)
- writerMap = new TreeMap<>();
- writerMap.put(id, w);
- }
- return add(w, close);
- }
-
- /**
- * Returns the number of inner writers in this tee writer.
- *
- * @return The number of writers.
- */
- public int size() {
- return writers.length;
- }
-
- /**
- * Returns the writer identified through the <c>id</c> parameter passed in through the
- * {@link #add(String, Writer, boolean)} method.
- *
- * @param id The ID associated with the writer.
- * @return The writer, or <jk>null</jk> if no identifier was specified when the writer was added.
- */
- public Writer getWriter(String id) {
- if (writerMap != null)
- return writerMap.get(id);
- return null;
- }
-
- @Override /* Writer */
- public void write(char[] cbuf, int off, int len) throws IOException {
- for (Writer w : writers)
- if (w != null)
- w.write(cbuf, off, len);
- }
-
- @Override /* Writer */
- public void flush() throws IOException {
- for (Writer w : writers)
- if (w != null)
- w.flush();
- }
-
- @Override /* Writer */
- public void close() throws IOException {
- IOException e = null;
- for (Writer w : writers) {
- if (w != null) {
- try {
- w.close();
- } catch (IOException e2) {
- e = e2;
- }
- }
- }
- if (e != null)
- throw e;
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/WriterOutputStream.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/WriterOutputStream.java
deleted file mode 100644
index e14a4f6..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/WriterOutputStream.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.juneau.internal;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
-
-/**
- * {@link OutputStream} implementation that transforms a byte stream to a
- * character stream using a specified charset encoding and writes the resulting
- * stream to a {@link Writer}. The stream is transformed using a
- * {@link CharsetDecoder} object, guaranteeing that all charset
- * encodings supported by the JRE are handled correctly.
- * <p>
- * The output of the {@link CharsetDecoder} is buffered using a fixed size buffer.
- * This implies that the data is written to the underlying {@link Writer} in chunks
- * that are no larger than the size of this buffer. By default, the buffer is
- * flushed only when it overflows or when {@link #flush()} or {@link #close()}
- * is called. In general there is therefore no need to wrap the underlying {@link Writer}
- * in a {@link java.io.BufferedWriter}. {@link WriterOutputStream} can also
- * be instructed to flush the buffer after each write operation. In this case, all
- * available data is written immediately to the underlying {@link Writer}, implying that
- * the current position of the {@link Writer} is correlated to the current position
- * of the {@link WriterOutputStream}.
- * <p>
- * {@link WriterOutputStream} implements the inverse transformation of {@link java.io.OutputStreamWriter};
- * in the following example, writing to {@code out2} would have the same result as writing to
- * {@code out} directly (provided that the byte sequence is legal with respect to the
- * charset encoding):
- * <pre>
- * OutputStream out = ...
- * Charset cs = ...
- * OutputStreamWriter writer = new OutputStreamWriter(out, cs);
- * WriterOutputStream out2 = new WriterOutputStream(writer, cs);</pre>
- * {@link WriterOutputStream} implements the same transformation as {@link java.io.InputStreamReader},
- * except that the control flow is reversed: both classes transform a byte stream
- * into a character stream, but {@link java.io.InputStreamReader} pulls data from the underlying stream,
- * while {@link WriterOutputStream} pushes it to the underlying stream.
- * <p>
- * Note that while there are use cases where there is no alternative to using
- * this class, very often the need to use this class is an indication of a flaw
- * in the design of the code. This class is typically used in situations where an existing
- * API only accepts an {@link OutputStream} object, but where the stream is known to represent
- * character data that must be decoded for further use.
- * <p>
- * Instances of {@link WriterOutputStream} are not thread safe.
- *
- * @since 2.0
- */
-public class WriterOutputStream extends OutputStream {
- private static final int BUFFER_SIZE = 1024;
-
- private final Writer writer;
- private final CharsetDecoder decoder;
- private final boolean writeImmediately;
-
- /**
- * ByteBuffer used as input for the decoder. This buffer can be small
- * as it is used only to transfer the received data to the
- * decoder.
- */
- private final ByteBuffer decoderIn = ByteBuffer.allocate(128);
-
- /**
- * CharBuffer used as output for the decoder. It should be
- * somewhat larger as we write from this buffer to the
- * underlying Writer.
- */
- private final CharBuffer decoderOut;
-
- /**
- * Constructs a new {@link WriterOutputStream} with a default output buffer size of 1024
- * characters. The output buffer will only be flushed when it overflows or when {@link #flush()} or {@link #close()}
- * is called.
- *
- * @param writer the target {@link Writer}
- * @param decoder the charset decoder
- * @since 2.1
- */
- public WriterOutputStream(final Writer writer, final CharsetDecoder decoder) {
- this(writer, decoder, BUFFER_SIZE, false);
- }
-
- /**
- * Constructs a new {@link WriterOutputStream}.
- *
- * @param writer the target {@link Writer}
- * @param decoder the charset decoder
- * @param bufferSize the size of the output buffer in number of characters
- * @param writeImmediately If {@code true} the output buffer will be flushed after each
- * write operation, i.e. all available data will be written to the
- * underlying {@link Writer} immediately. If {@code false}, the
- * output buffer will only be flushed when it overflows or when
- * {@link #flush()} or {@link #close()} is called.
- * @since 2.1
- */
- public WriterOutputStream(final Writer writer, final CharsetDecoder decoder, final int bufferSize,
- final boolean writeImmediately) {
- checkIbmJdkWithBrokenUTF16( decoder.charset());
- this.writer = writer;
- this.decoder = decoder;
- this.writeImmediately = writeImmediately;
- decoderOut = CharBuffer.allocate(bufferSize);
- }
-
- /**
- * Constructs a new {@link WriterOutputStream}.
- *
- * @param writer the target {@link Writer}
- * @param charset the charset encoding
- * @param bufferSize the size of the output buffer in number of characters
- * @param writeImmediately If {@code true} the output buffer will be flushed after each
- * write operation, i.e. all available data will be written to the
- * underlying {@link Writer} immediately. If {@code false}, the
- * output buffer will only be flushed when it overflows or when
- * {@link #flush()} or {@link #close()} is called.
- */
- public WriterOutputStream(final Writer writer, final Charset charset, final int bufferSize,
- final boolean writeImmediately) {
- this(writer,
- charset.newDecoder()
- .onMalformedInput(CodingErrorAction.REPLACE)
- .onUnmappableCharacter(CodingErrorAction.REPLACE)
- .replaceWith("?"),
- bufferSize,
- writeImmediately);
- }
-
- /**
- * Constructs a new {@link WriterOutputStream} with a default output buffer size of 1024
- * characters. The output buffer will only be flushed when it overflows or when {@link #flush()} or {@link #close()}
- * is called.
- *
- * @param writer the target {@link Writer}
- * @param charset the charset encoding
- */
- public WriterOutputStream(final Writer writer, final Charset charset) {
- this(writer, charset, BUFFER_SIZE, false);
- }
-
- /**
- * Constructs a new {@link WriterOutputStream}.
- *
- * @param writer the target {@link Writer}
- * @param charsetName the name of the charset encoding
- * @param bufferSize the size of the output buffer in number of characters
- * @param writeImmediately If {@code true} the output buffer will be flushed after each
- * write operation, i.e. all available data will be written to the
- * underlying {@link Writer} immediately. If {@code false}, the
- * output buffer will only be flushed when it overflows or when
- * {@link #flush()} or {@link #close()} is called.
- */
- public WriterOutputStream(final Writer writer, final String charsetName, final int bufferSize,
- final boolean writeImmediately) {
- this(writer, Charset.forName(charsetName), bufferSize, writeImmediately);
- }
-
- /**
- * Constructs a new {@link WriterOutputStream} with a default output buffer size of 1024
- * characters. The output buffer will only be flushed when it overflows or when {@link #flush()} or {@link #close()}
- * is called.
- *
- * @param writer the target {@link Writer}
- * @param charsetName the name of the charset encoding
- */
- public WriterOutputStream(final Writer writer, final String charsetName) {
- this(writer, charsetName, BUFFER_SIZE, false);
- }
-
- /**
- * Write bytes from the specified byte array to the stream.
- *
- * @param b the byte array containing the bytes to write
- * @param off the start offset in the byte array
- * @param len the number of bytes to write
- * @throws IOException if an I/O error occurs
- */
- @Override
- public void write(final byte[] b, int off, int len) throws IOException {
- while (len > 0) {
- final int c = Math.min(len, decoderIn.remaining());
- decoderIn.put(b, off, c);
- processInput(false);
- len -= c;
- off += c;
- }
- if (writeImmediately) {
- flushOutput();
- }
- }
-
- /**
- * Write bytes from the specified byte array to the stream.
- *
- * @param b the byte array containing the bytes to write
- * @throws IOException if an I/O error occurs
- */
- @Override
- public void write(final byte[] b) throws IOException {
- write(b, 0, b.length);
- }
-
- /**
- * Write a single byte to the stream.
- *
- * @param b the byte to write
- * @throws IOException if an I/O error occurs
- */
- @Override
- public void write(final int b) throws IOException {
- write(new byte[] { (byte)b }, 0, 1);
- }
-
- /**
- * Flush the stream. Any remaining content accumulated in the output buffer
- * will be written to the underlying {@link Writer}. After that
- * {@link Writer#flush()} will be called.
- * @throws IOException if an I/O error occurs
- */
- @Override
- public void flush() throws IOException {
- flushOutput();
- writer.flush();
- }
-
- /**
- * Close the stream. Any remaining content accumulated in the output buffer
- * will be written to the underlying {@link Writer}. After that
- * {@link Writer#close()} will be called.
- * @throws IOException if an I/O error occurs
- */
- @Override
- public void close() throws IOException {
- processInput(true);
- flushOutput();
- writer.close();
- }
-
- /**
- * Decode the contents of the input ByteBuffer into a CharBuffer.
- *
- * @param endOfInput indicates end of input
- * @throws IOException if an I/O error occurs
- */
- private void processInput(final boolean endOfInput) throws IOException {
- // Prepare decoderIn for reading
- decoderIn.flip();
- CoderResult coderResult;
- while (true) {
- coderResult = decoder.decode(decoderIn, decoderOut, endOfInput);
- if (coderResult.isOverflow()) {
- flushOutput();
- } else if (coderResult.isUnderflow()) {
- break;
- } else {
- // The decoder is configured to replace malformed input and unmappable characters,
- // so we should not get here.
- throw new IOException("Unexpected coder result");
- }
- }
- // Discard the bytes that have been read
- decoderIn.compact();
- }
-
- /**
- * Flush the output.
- *
- * @throws IOException if an I/O error occurs
- */
- private void flushOutput() throws IOException {
- if (decoderOut.position() > 0) {
- writer.write(decoderOut.array(), 0, decoderOut.position());
- decoderOut.rewind();
- }
- }
-
- /**
- * Check if the JDK in use properly supports the given charset.
- *
- * @param charset the charset to check the support for
- */
- private static void checkIbmJdkWithBrokenUTF16(final Charset charset){
- if (!"UTF-16".equals(charset.name())) {
- return;
- }
- final String TEST_STRING_2 = "v\u00e9s";
- final byte[] bytes = TEST_STRING_2.getBytes(charset);
-
- final CharsetDecoder charsetDecoder2 = charset.newDecoder();
- final ByteBuffer bb2 = ByteBuffer.allocate(16);
- final CharBuffer cb2 = CharBuffer.allocate(TEST_STRING_2.length());
- final int len = bytes.length;
- for (int i = 0; i < len; i++) {
- bb2.put(bytes[i]);
- bb2.flip();
- try {
- charsetDecoder2.decode(bb2, cb2, i == (len - 1));
- } catch ( final IllegalArgumentException e){
- throw new UnsupportedOperationException("UTF-16 requested when runninng on an IBM JDK with broken UTF-16 support. " +
- "Please find a JDK that supports UTF-16 if you intend to use UF-16 with WriterOutputStream");
- }
- bb2.compact();
- }
- cb2.rewind();
- if (!TEST_STRING_2.equals(cb2.toString())){
- throw new UnsupportedOperationException("UTF-16 requested when runninng on an IBM JDK with broken UTF-16 support. " +
- "Please find a JDK that supports UTF-16 if you intend to use UF-16 with WriterOutputStream");
- }
-
- }
-}
-
-
-
-
-
-
-
-
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
index 743785c..19a5719 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
@@ -18,7 +18,6 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.internal.*;
-import org.apache.juneau.utils.*;
/**
* Subclass of {@link Serializer} for character-based serializers.
@@ -398,16 +397,6 @@ public abstract class WriterSerializer extends Serializer {
}
/**
- * Wraps the specified object inside a {@link StringObject}.
- *
- * @param o The object to wrap.
- * @return The wrapped object.
- */
- public final StringObject toStringObject(Object o) {
- return new StringObject(this, o);
- }
-
- /**
* Convenience method for serializing an object and sending it to STDOUT.
*
* @param o The object to serialize.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerator.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerator.java
deleted file mode 100644
index d20215a..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-/**
- * Simple interface for defining atomic ID generators.
- *
- * @param <K> The ID type.
- */
-public interface IdGenerator<K> {
-
- /**
- * Returns the next available ID.
- *
- * @return The next available ID.
- */
- K next();
-
- /**
- * Sets a lower bound for this generator.
- *
- * @param k The lower bound.
- */
- void lb(K k);
-}
\ No newline at end of file
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerators.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerators.java
deleted file mode 100644
index 8780be7..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdGenerators.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import java.util.concurrent.atomic.*;
-
-/**
- * Predefined ID generators.
- */
-public class IdGenerators {
-
- /**
- * Creates an ID generator using {@link AtomicInteger} initialized to value <c>1</c>.
- *
- * @param initValue The initial value.
- * @return A new ID generator.
- */
- public static IdGenerator<Integer> createIntGenerator(final int initValue) {
- return new IdGenerator<Integer>() {
- private final AtomicInteger i = new AtomicInteger(initValue);
-
- @Override /* IdGenerator */
- public synchronized Integer next() {
- return i.getAndIncrement();
- }
-
- @Override
- public synchronized void lb(Integer k) {
- i.set(Math.max(k + 1, i.get()));
- }
- };
- }
-
- /**
- * Creates an ID generator using {@link AtomicInteger} initialized to the specified value.
- *
- * @return A new ID generator.
- */
- public static IdGenerator<Integer> createIntGenerator() {
- return createIntGenerator(1);
- }
-
- /**
- * Creates an ID generator using {@link AtomicLong} initialized to value <c>1</c>.
- *
- * @param initValue The initial value.
- * @return A new ID generator.
- */
- public static IdGenerator<Long> createLongGenerator(final long initValue) {
- return new IdGenerator<Long>() {
- private final AtomicLong l = new AtomicLong(initValue);
-
- @Override /* IdGenerator */
- public synchronized Long next() {
- return l.getAndIncrement();
- }
-
- @Override
- public synchronized void lb(Long k) {
- l.set(Math.max(k + 1, l.get()));
- }
- };
- }
-
- /**
- * Creates an ID generator using {@link AtomicLong} initialized to the specified value.
- *
- * @return A new ID generator.
- */
- public static IdGenerator<Long> createLongGenerator() {
- return createLongGenerator(1);
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdMap.java
deleted file mode 100644
index bedc48b..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IdMap.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import java.util.concurrent.*;
-
-/**
- * Map consisting of auto-generated atomic keys.
- *
- * <p>
- * Useful for creating in-memory 'databases' of POJOs.
- *
- * @param <K> The key type.
- * @param <V> The value type.
- */
-public class IdMap<K,V> extends ConcurrentHashMap<K,V> {
-
- private static final long serialVersionUID = 1L;
-
- private final IdGenerator<K> idGen;
-
-
- /**
- * Creates a new ID map with integer keys with generator initialized to <c>1</c>.
- *
- * @param c The value type.
- * @return A new map.
- */
- public static <T> IdMap<Integer,T> createIntMap(Class<T> c) {
- return createIntMap(c, 1);
- }
-
- /**
- * Creates a new ID map with integer keys with generator initialized to the specified value.
- *
- * @param c The value type.
- * @param initValue The initial value of the generator.
- * @return A new map.
- */
- public static <T> IdMap<Integer,T> createIntMap(Class<T> c, int initValue) {
- return create(c, IdGenerators.createIntGenerator(initValue));
- }
-
- /**
- * Creates a new ID map with long keys with generator initialized to <c>1</c>.
- *
- * @param c The value type.
- * @return A new map.
- */
- public static <T> IdMap<Long,T> createLongMap(Class<T> c) {
- return createLongMap(c, 1l);
- }
-
- /**
- * Creates a new ID map with long keys with generator initialized to the specified value.
- *
- * @param c The value type.
- * @param initValue The initial value of the generator.
- * @return A new map.
- */
- public static <T> IdMap<Long,T> createLongMap(Class<T> c, long initValue) {
- return create(c, IdGenerators.createLongGenerator(initValue));
- }
-
- /**
- * Creates a new map.
- *
- * @param c The value type.
- * @param idGen An ID generator.
- * @return A new instance.
- */
- public static <K,T> IdMap<K,T> create(Class<T> c, IdGenerator<K> idGen) {
- return new IdMap<>(c, idGen);
- }
-
- private IdMap(Class<V> c, IdGenerator<K> idGen) {
- this.idGen = idGen;
- }
-
- /**
- * Returns the next available ID.
- *
- * @return The next available ID.
- */
- public K nextId() {
- return idGen.next();
- }
-
- /**
- * Sets a lower bound on the specified ID.
- * @param k The lower-bound key.
- */
- public void lbId(K k) {
- idGen.lb(k);
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java
deleted file mode 100644
index a238fd3..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java
+++ /dev/null
@@ -1,411 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import static org.apache.juneau.internal.IOUtils.*;
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.logging.*;
-
-import org.apache.juneau.internal.*;
-import org.apache.juneau.utils.IOPipe.*;
-
-/**
- * Utility class for running operating system processes.
- *
- * <p>
- * Similar to {@link java.lang.ProcessBuilder} but with additional features.
- */
-public class ProcBuilder {
-
- private java.lang.ProcessBuilder pb = new java.lang.ProcessBuilder();
- private TeeWriter outWriters = new TeeWriter(), logWriters = new TeeWriter();
- private LineProcessor lp;
- private Process p;
- private int maxExitStatus = 0;
- private boolean byLines;
- private String divider = "--------------------------------------------------------------------------------";
-
- /**
- * Creates a process builder with the specified arguments.
- *
- * <p>
- * Equivalent to calling <c>ProcessBuilder.create().command(args);</c>
- *
- * @param args The command-line arguments.
- * @return A new process builder.
- */
- public static ProcBuilder create(Object...args) {
- return new ProcBuilder().command(args);
- }
-
- /**
- * Creates an empty process builder.
- *
- * @return A new process builder.
- */
- public static ProcBuilder create() {
- return new ProcBuilder().command();
- }
-
- /**
- * Command arguments.
- *
- * <p>
- * Arguments can be collections or arrays and will be automatically expanded.
- *
- * @param args The command-line arguments.
- * @return This object (for method chaining).
- */
- public ProcBuilder command(Object...args) {
- return commandIf(ANY, args);
- }
-
- /**
- * Command arguments if the specified matcher matches.
- *
- * <p>
- * Can be used for specifying OS-specific commands.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode w800'>
- * ProcBuilder pb = ProcBuilder
- * .create()
- * .commandIf(<jsf>WINDOWS</jsf>, <js>"cmd /c dir"</js>)
- * .commandIf(<jsf>UNIX</jsf>, <js>"bash -c ls"</js>)
- * .merge()
- * .execute();
- * </p>
- *
- * @param m The matcher.
- * @param args The command line arguments if matcher matches.
- * @return This object (for method chaining).
- */
- public ProcBuilder commandIf(Matcher m, Object...args) {
- if (m.matches())
- pb.command(toList(args));
- return this;
- }
-
- /**
- * Append to the command arguments.
- *
- * <p>
- * Arguments can be collections or arrays and will be automatically expanded.
- *
- * @param args The command-line arguments.
- * @return This object (for method chaining).
- */
- public ProcBuilder append(Object...args) {
- return appendIf(ANY, args);
- }
-
- /**
- * Append to the command arguments if the specified matcher matches.
- *
- * <p>
- * Arguments can be collections or arrays and will be automatically expanded.
- *
- * @param m The matcher.
- * @param args The command line arguments if matcher matches.
- * @return This object (for method chaining).
- */
- public ProcBuilder appendIf(Matcher m, Object...args) {
- if (m.matches())
- pb.command().addAll(toList(args));
- return this;
- }
-
- /**
- * Merge STDOUT and STDERR into a single stream.
- *
- * @return This object (for method chaining).
- */
- public ProcBuilder merge() {
- pb.redirectErrorStream(true);
- return this;
- }
-
- /**
- * Use by-lines mode.
- *
- * <p>
- * Flushes output after every line of input.
- *
- * @return This object (for method chaining).
- */
- public ProcBuilder byLines() {
- this.byLines = true;
- return this;
- }
-
- /**
- * Pipe output to the specified writer.
- *
- * <p>
- * The method can be called multiple times to write to multiple writers.
- *
- * @param w The writer to pipe to.
- * @param close Close the writer afterwards.
- * @return This object (for method chaining).
- */
- public ProcBuilder pipeTo(Writer w, boolean close) {
- this.outWriters.add(w, close);
- return this;
- }
-
- /**
- * Pipe output to the specified writer, but don't close the writer.
- *
- * @param w The writer to pipe to.
- * @return This object (for method chaining).
- */
- public ProcBuilder pipeTo(Writer w) {
- return pipeTo(w, false);
- }
-
- /**
- * Pipe output to the specified writer, including the command and return code.
- *
- * <p>
- * The method can be called multiple times to write to multiple writers.
- *
- * @param w The writer to pipe to.
- * @param close Close the writer afterwards.
- * @return This object (for method chaining).
- */
- public ProcBuilder logTo(Writer w, boolean close) {
- this.logWriters.add(w, close);
- this.outWriters.add(w, close);
- return this;
- }
-
- /**
- * Pipe output to the specified writer, including the command and return code.
- *
- * <p>
- * The method can be called multiple times to write to multiple writers.
- * Don't close the writer afterwards.
- *
- * @param w The writer to pipe to.
- * @return This object (for method chaining).
- */
- public ProcBuilder logTo(Writer w) {
- return logTo(w, false);
- }
-
- /**
- * Pipe output to the specified writer, including the command and return code.
- * The method can be called multiple times to write to multiple writers.
- *
- * @param level The log level.
- * @param logger The logger to log to.
- * @return This object (for method chaining).
- */
- public ProcBuilder logTo(final Level level, final Logger logger) {
- if (logger.isLoggable(level)) {
- logTo(new StringWriter() {
- private boolean isClosed; // Prevents messages from being written twice.
- @Override /* Writer */
- public void close() {
- if (! isClosed)
- logger.log(level, this.toString());
- isClosed = true;
- }
- }, true);
- }
- return this;
- }
-
- /**
- * Line processor to use to process/convert lines of output returned by the process.
- *
- * @param lp The new line processor.
- * @return This object (for method chaining).
- */
- public ProcBuilder lp(LineProcessor lp) {
- this.lp = lp;
- return this;
- }
-
- /**
- * Append the specified environment variables to the process.
- *
- * @param env The new set of environment variables.
- * @return This object (for method chaining).
- */
- @SuppressWarnings({"rawtypes"})
- public ProcBuilder env(Map env) {
- if (env != null)
- for (Map.Entry e : (Set<Map.Entry>)env.entrySet())
- environment(e.getKey().toString(), e.getValue() == null ? null : e.getValue().toString());
- return this;
- }
-
- /**
- * Append the specified environment variable.
- *
- * @param key The environment variable name.
- * @param val The environment variable value.
- * @return This object (for method chaining).
- */
- public ProcBuilder environment(String key, String val) {
- pb.environment().put(key, val);
- return this;
- }
-
- /**
- * Sets the directory where the command will be executed.
- *
- * @param directory The directory.
- * @return This object (for method chaining).
- */
- public ProcBuilder directory(File directory) {
- pb.directory(directory);
- return this;
- }
-
- /**
- * Sets the maximum allowed return code on the process call.
- *
- * <p>
- * If the return code exceeds this value, an IOException is returned on the {@link #run()} command.
- * The default value is '0'.
- *
- * @param maxExitStatus The maximum exit status.
- * @return This object (for method chaining).
- */
- public ProcBuilder maxExitStatus(int maxExitStatus) {
- this.maxExitStatus = maxExitStatus;
- return this;
- }
-
- /**
- * Run this command and pipes the output to the specified writer or output stream.
- *
- * @return The exit code from the process.
- * @throws IOException Thrown by underlying stream.
- * @throws InterruptedException Thread was interrupted.
- */
- public int run() throws IOException, InterruptedException {
- if (pb.command().size() == 0)
- throw new IOException("No command specified in ProcBuilder.");
- try {
- logWriters.append(divider).append('\n').flush();
- logWriters.append(join(pb.command(), " ")).append('\n').flush();
- p = pb.start();
- IOPipe.create(p.getInputStream(), outWriters).lineProcessor(lp).byLines(byLines).run();
- int rc = p.waitFor();
- logWriters.append("Exit: ").append(String.valueOf(p.exitValue())).append('\n').flush();
- if (rc > maxExitStatus)
- throw new IOException("Return code "+rc+" from command " + join(pb.command(), " "));
- return rc;
- } finally {
- close();
- }
- }
-
- /**
- * Run this command and returns the output as a simple string.
- *
- * @return The output from the command.
- * @throws IOException Thrown by underlying stream.
- * @throws InterruptedException Thread was interrupted.
- */
- public String getOutput() throws IOException, InterruptedException {
- StringWriter sw = new StringWriter();
- pipeTo(sw).run();
- return sw.toString();
- }
-
- /**
- * Returns the output from this process as a {@link Scanner}.
- *
- * @return The output from the process as a Scanner object.
- * @throws IOException Thrown by underlying stream.
- * @throws InterruptedException Thread was interrupted.
- */
- public Scanner getScanner() throws IOException, InterruptedException {
- StringWriter sw = new StringWriter();
- pipeTo(sw, true);
- run();
- return new Scanner(sw.toString());
- }
-
- /**
- * Destroys the underlying process.
- *
- * <p>
- * This method is only needed if the {@link #getScanner()} method was used.
- */
- private void close() {
- closeQuietly(logWriters, outWriters);
- if (p != null)
- p.destroy();
- }
-
- /**
- * Specifies interface for defining OS-specific commands.
- */
- public abstract static class Matcher {
- abstract boolean matches();
- }
-
- static final String OS = System.getProperty("os.name").toLowerCase();
-
- /** Operating system matcher: Any operating system. */
- public static final Matcher ANY = new Matcher() {
- @Override boolean matches() {
- return true;
- }
- };
-
- /** Operating system matcher: Any Windows system. */
- public static final Matcher WINDOWS = new Matcher() {
- @Override boolean matches() {
- return OS.indexOf("win") >= 0;
- }
- };
-
- /** Operating system matcher: Any Mac system. */
- public static final Matcher MAC = new Matcher() {
- @Override boolean matches() {
- return OS.indexOf("mac") >= 0;
- }
- };
-
- /** Operating system matcher: Any Unix or Linux system. */
- public static final Matcher UNIX = new Matcher() {
- @Override boolean matches() {
- return OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0;
- }
- };
-
- private static List<String> toList(Object...args) {
- List<String> l = new LinkedList<>();
- for (Object o : args) {
- if (o.getClass().isArray())
- for (int i = 0; i < Array.getLength(o); i++)
- l.add(Array.get(o, i).toString());
- else if (o instanceof Collection)
- for (Object o2 : (Collection<?>)o)
- l.add(o2.toString());
- else
- l.add(o.toString());
- }
- return l;
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringMessage.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringMessage.java
deleted file mode 100644
index 68988ce..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringMessage.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.io.*;
-import java.text.*;
-
-import org.apache.juneau.*;
-
-/**
- * An encapsulated MessageFormat-style string and arguments.
- *
- * <p>
- * Useful for delayed serialization of arguments for logging.
- * Message string will not be constructed until the <c>toString()</c> method is called.
- */
-public class StringMessage implements CharSequence, Writable {
-
- private final String pattern;
- private final Object[] args;
- private String results;
-
- /**
- * Constructor.
- *
- * @param pattern {@link MessageFormat}-style pattern.
- * @param args Message arguments.
- */
- public StringMessage(String pattern, Object...args) {
- this.pattern = pattern;
- this.args = args;
- }
-
- @Override /* Writable */
- public Writer writeTo(Writer w) throws IOException {
- w.write(toString());
- return w;
- }
-
- @Override /* Writable */
- public String getMediaType() {
- return null;
- }
-
- @Override /* CharSequence */
- public char charAt(int index) {
- return toString().charAt(index);
- }
-
- @Override /* CharSequence */
- public int length() {
- return toString().length();
- }
-
- @Override /* CharSequence */
- public CharSequence subSequence(int start, int end) {
- return toString().subSequence(start, end);
- }
-
- @Override /* Object */
- public String toString() {
- if (results == null)
- results = format(pattern, args);
- return results;
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringObject.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringObject.java
deleted file mode 100644
index f389978..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringObject.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import java.io.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.json.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * A serializer/object pair used for delayed object serialization.
- *
- * <p>
- * Useful in certain conditions such as logging when you don't want to needlessly serialize objects.
- *
- * <p>
- * Instances of this method are created by the {@link WriterSerializer#toStringObject(Object)} method.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode w800'>
- * <jc>// The POJO will not be serialized unless DEBUG is enabled.</jc>
- * logger.log(<jsf>DEBUG</jsf>, <js>"Object contents are: {0}"</js>, JsonSerializer.<jsf>DEFAULT</jsf>.toObjectString(myPojo));
- * </p>
- */
-public class StringObject implements CharSequence, Writable {
-
- private final WriterSerializer s;
- private final Object o;
- private String results;
-
- /**
- * Constructor.
- *
- * @param s The serializer to use to serialize the object.
- * @param o The object to be serialized.
- */
- public StringObject(WriterSerializer s, Object o) {
- this.s = s;
- this.o = o;
- }
-
- /**
- * Constructor with default serializer {@link SimpleJsonSerializer#DEFAULT}
- *
- * @param o The object to be serialized.
- */
- public StringObject(Object o) {
- this(SimpleJsonSerializer.DEFAULT, o);
- }
-
- @Override /* Object */
- public String toString() {
- if (results == null)
- results = s.toString(o);
- return results;
- }
-
- @Override /* CharSequence */
- public int length() {
- return toString().length();
- }
-
- @Override /* CharSequence */
- public char charAt(int index) {
- return toString().charAt(index);
- }
-
- @Override /* CharSequence */
- public CharSequence subSequence(int start, int end) {
- return toString().subSequence(start, end);
- }
-
- @Override /* Writable */
- public Writer writeTo(Writer w) throws IOException {
- try {
- s.serialize(o, w);
- return w;
- } catch (SerializeException e) {
- throw new IOException(e);
- }
- }
-
- @Override /* Writable */
- public String getMediaType() {
- return s.getPrimaryMediaType().toString();
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java
deleted file mode 100644
index a9e4c17..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java
+++ /dev/null
@@ -1,173 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.http.annotation.*;
-
-/**
- * Utility class for representing the contents of a zip file as a list of entries whose contents don't resolve until
- * serialization time.
- *
- * <p>
- * Generally associated with <c>RestServlets</c> using the <c>responseHandlers</c> annotation so that
- * REST methods can easily create ZIP file responses by simply returning instances of this class.
- */
-@Response
-public class ZipFileList extends LinkedList<ZipFileList.ZipFileEntry> implements Streamable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * The name of the zip file.
- */
- public final String fileName;
-
- @Header("Content-Type")
- @Override /* Streamable */
- public String getMediaType() {
- return "application/zip";
- }
-
- /**
- * Returns the value for the <c>Content-Disposition</c> header.
- *
- * @return The value for the <c>Content-Disposition</c> header.
- */
- @Header("Content-Disposition")
- public String getContentDisposition() {
- return "attachment;filename=" + fileName;
- }
-
- @ResponseBody
- @Override /* Streamable */
- public void streamTo(OutputStream os) throws IOException {
- try (ZipOutputStream zos = new ZipOutputStream(os)) {
- for (ZipFileEntry e : this)
- e.write(zos);
- }
- os.flush();
- }
-
- /**
- * Constructor.
- *
- * @param fileName The file name of the zip file to create.
- */
- public ZipFileList(String fileName) {
- this.fileName = fileName;
- }
-
- /**
- * Add an entry to this list.
- *
- * @param e The zip file entry.
- * @return This object (for method chaining).
- */
- public ZipFileList append(ZipFileEntry e) {
- add(e);
- return this;
- }
-
- /**
- * Interface for ZipFileList entries.
- */
- public static interface ZipFileEntry {
- /**
- * Write this entry to the specified output stream.
- *
- * @param zos The output stream to write to.
- * @throws IOException Thrown by underlying stream.
- */
- void write(ZipOutputStream zos) throws IOException;
- }
-
- /**
- * ZipFileList entry for File entry types.
- */
- public static class FileEntry implements ZipFileEntry {
-
- /** The root file to base the entry paths on. */
- protected File root;
-
- /** The file being zipped. */
- protected File file;
-
- /**
- * Constructor.
- *
- * @param root The root file that represents the base path.
- * @param file The file to add to the zip file.
- */
- public FileEntry(File root, File file) {
- this.root = root;
- this.file = file;
- }
-
- /**
- * Constructor.
- *
- * @param file The file to add to the zip file.
- */
- public FileEntry(File file) {
- this.file = file;
- this.root = (file.isDirectory() ? file : file.getParentFile());
- }
-
- @Override /* ZipFileEntry */
- public void write(ZipOutputStream zos) throws IOException {
- addFile(zos, file);
- }
-
- /**
- * Subclasses can override this method to customize which files get added to a zip file.
- *
- * @param f The file being added to the zip file.
- * @return Always returns <jk>true</jk>.
- */
- public boolean doAdd(File f) {
- return true;
- }
-
- /**
- * Adds the specified file to the specified output stream.
- *
- * @param zos The output stream.
- * @param f The file to add.
- * @throws IOException Thrown by underlying stream.
- */
- protected void addFile(ZipOutputStream zos, File f) throws IOException {
- if (doAdd(f)) {
- if (f.isDirectory()) {
- File[] fileList = f.listFiles();
- if (fileList == null)
- throw new IOException(f.toString());
- for (File fc : fileList)
- addFile(zos, fc);
- } else if (f.canRead()) {
- String path = f.getAbsolutePath().substring(root.getAbsolutePath().length() + 1).replace('\\', '/');
- ZipEntry e = new ZipEntry(path);
- e.setSize(f.length());
- zos.putNextEntry(e);
- try (FileInputStream fis = new FileInputStream(f)) {
- IOPipe.create(fis, zos).run();
- }
- }
- }
- }
- }
-}
diff --git a/pom.xml b/pom.xml
index 54d8ff8..597bac6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,7 +351,6 @@
<excludes>
<exclude>**/doc/**/*</exclude>
<exclude>**/examples/**/*</exclude>
- <exclude>**/testutils/**/*</exclude>
</excludes>
<fileSets>
<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">