diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /mobile/android/thirdparty/ch/boye/httpclientandroidlib/io | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/thirdparty/ch/boye/httpclientandroidlib/io')
10 files changed, 645 insertions, 0 deletions
diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/BufferInfo.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/BufferInfo.java new file mode 100644 index 000000000..b75ddd8fc --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/BufferInfo.java @@ -0,0 +1,58 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +/** + * Basic buffer properties. + * + * @since 4.1 + */ +public interface BufferInfo { + + /** + * Return length data stored in the buffer + * + * @return data length + */ + int length(); + + /** + * Returns total capacity of the buffer + * + * @return total capacity + */ + int capacity(); + + /** + * Returns available space in the buffer. + * + * @return available space. + */ + int available(); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/EofSensor.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/EofSensor.java new file mode 100644 index 000000000..bd577b7e4 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/EofSensor.java @@ -0,0 +1,42 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +/** + * EOF sensor. + * + * @since 4.0 + * + * @deprecated (4.3) no longer used. + */ +@Deprecated +public interface EofSensor { + + boolean isEof(); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParser.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParser.java new file mode 100644 index 000000000..2a6f4f3f8 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParser.java @@ -0,0 +1,56 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import java.io.IOException; + +import ch.boye.httpclientandroidlib.HttpException; +import ch.boye.httpclientandroidlib.HttpMessage; + +/** + * Abstract message parser intended to build HTTP messages from an arbitrary data source. + * + * @param <T> + * {@link HttpMessage} or a subclass + * + * @since 4.0 + */ +public interface HttpMessageParser<T extends HttpMessage> { + + /** + * Generates an instance of {@link HttpMessage} from the underlying data + * source. + * + * @return HTTP message + * @throws IOException in case of an I/O error + * @throws HttpException in case of HTTP protocol violation + */ + T parse() + throws IOException, HttpException; + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParserFactory.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParserFactory.java new file mode 100644 index 000000000..c550120a5 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageParserFactory.java @@ -0,0 +1,42 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import ch.boye.httpclientandroidlib.HttpMessage; +import ch.boye.httpclientandroidlib.config.MessageConstraints; + +/** + * Factory for {@link HttpMessageParser} instances. + * + * @since 4.3 + */ +public interface HttpMessageParserFactory<T extends HttpMessage> { + + HttpMessageParser<T> create(SessionInputBuffer buffer, MessageConstraints constraints); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriter.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriter.java new file mode 100644 index 000000000..7b4557e92 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriter.java @@ -0,0 +1,54 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import java.io.IOException; + +import ch.boye.httpclientandroidlib.HttpException; +import ch.boye.httpclientandroidlib.HttpMessage; + +/** + * Abstract message writer intended to serialize HTTP messages to an arbitrary + * data sink. + * + * @since 4.0 + */ +public interface HttpMessageWriter<T extends HttpMessage> { + + /** + * Serializes an instance of {@link HttpMessage} to the underlying data + * sink. + * + * @param message HTTP message + * @throws IOException in case of an I/O error + * @throws HttpException in case of HTTP protocol violation + */ + void write(T message) + throws IOException, HttpException; + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriterFactory.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriterFactory.java new file mode 100644 index 000000000..3e8ad0552 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpMessageWriterFactory.java @@ -0,0 +1,41 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import ch.boye.httpclientandroidlib.HttpMessage; + +/** + * Factory for {@link HttpMessageWriter} instances. + * + * @since 4.3 + */ +public interface HttpMessageWriterFactory<T extends HttpMessage> { + + HttpMessageWriter<T> create(SessionOutputBuffer buffer); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpTransportMetrics.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpTransportMetrics.java new file mode 100644 index 000000000..6eeb6ede1 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/HttpTransportMetrics.java @@ -0,0 +1,48 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +/** + * The point of access to the statistics of {@link SessionInputBuffer} or + * {@link SessionOutputBuffer}. + * + * @since 4.0 + */ +public interface HttpTransportMetrics { + + /** + * Returns the number of bytes transferred. + */ + long getBytesTransferred(); + + /** + * Resets the counts + */ + void reset(); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionInputBuffer.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionInputBuffer.java new file mode 100644 index 000000000..80417801d --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionInputBuffer.java @@ -0,0 +1,152 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import java.io.IOException; + +import ch.boye.httpclientandroidlib.util.CharArrayBuffer; + +/** + * Session input buffer for blocking connections. This interface is similar to + * InputStream class, but it also provides methods for reading lines of text. + * <p> + * Implementing classes are also expected to manage intermediate data buffering + * for optimal input performance. + * + * @since 4.0 + */ +public interface SessionInputBuffer { + + /** + * Reads up to <code>len</code> bytes of data from the session buffer into + * an array of bytes. An attempt is made to read as many as + * <code>len</code> bytes, but a smaller number may be read, possibly + * zero. The number of bytes actually read is returned as an integer. + * + * <p> This method blocks until input data is available, end of file is + * detected, or an exception is thrown. + * + * <p> If <code>off</code> is negative, or <code>len</code> is negative, or + * <code>off+len</code> is greater than the length of the array + * <code>b</code>, then an <code>IndexOutOfBoundsException</code> is + * thrown. + * + * @param b the buffer into which the data is read. + * @param off the start offset in array <code>b</code> + * at which the data is written. + * @param len the maximum number of bytes to read. + * @return the total number of bytes read into the buffer, or + * <code>-1</code> if there is no more data because the end of + * the stream has been reached. + * @exception IOException if an I/O error occurs. + */ + int read(byte[] b, int off, int len) throws IOException; + + /** + * Reads some number of bytes from the session buffer and stores them into + * the buffer array <code>b</code>. The number of bytes actually read is + * returned as an integer. This method blocks until input data is + * available, end of file is detected, or an exception is thrown. + * + * @param b the buffer into which the data is read. + * @return the total number of bytes read into the buffer, or + * <code>-1</code> is there is no more data because the end of + * the stream has been reached. + * @exception IOException if an I/O error occurs. + */ + int read(byte[] b) throws IOException; + + /** + * Reads the next byte of data from this session buffer. The value byte is + * returned as an <code>int</code> in the range <code>0</code> to + * <code>255</code>. If no byte is available because the end of the stream + * has been reached, the value <code>-1</code> is returned. This method + * blocks until input data is available, the end of the stream is detected, + * or an exception is thrown. + * + * @return the next byte of data, or <code>-1</code> if the end of the + * stream is reached. + * @exception IOException if an I/O error occurs. + */ + int read() throws IOException; + + /** + * Reads a complete line of characters up to a line delimiter from this + * session buffer into the given line buffer. The number of chars actually + * read is returned as an integer. The line delimiter itself is discarded. + * If no char is available because the end of the stream has been reached, + * the value <code>-1</code> is returned. This method blocks until input + * data is available, end of file is detected, or an exception is thrown. + * <p> + * The choice of a char encoding and line delimiter sequence is up to the + * specific implementations of this interface. + * + * @param buffer the line buffer. + * @return one line of characters + * @exception IOException if an I/O error occurs. + */ + int readLine(CharArrayBuffer buffer) throws IOException; + + /** + * Reads a complete line of characters up to a line delimiter from this + * session buffer. The line delimiter itself is discarded. If no char is + * available because the end of the stream has been reached, + * <code>null</code> is returned. This method blocks until input data is + * available, end of file is detected, or an exception is thrown. + * <p> + * The choice of a char encoding and line delimiter sequence is up to the + * specific implementations of this interface. + * + * @return HTTP line as a string + * @exception IOException if an I/O error occurs. + */ + String readLine() throws IOException; + + /** Blocks until some data becomes available in the session buffer or the + * given timeout period in milliseconds elapses. If the timeout value is + * <code>0</code> this method blocks indefinitely. + * + * @param timeout in milliseconds. + * @return <code>true</code> if some data is available in the session + * buffer or <code>false</code> otherwise. + * @exception IOException if an I/O error occurs. + * + * @deprecated (4.3) do not use. This function should be provided at the + * connection level + */ + @Deprecated + boolean isDataAvailable(int timeout) throws IOException; + + /** + * Returns {@link HttpTransportMetrics} for this session buffer. + * + * @return transport metrics. + */ + HttpTransportMetrics getMetrics(); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionOutputBuffer.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionOutputBuffer.java new file mode 100644 index 000000000..544d17d5a --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/SessionOutputBuffer.java @@ -0,0 +1,120 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package ch.boye.httpclientandroidlib.io; + +import java.io.IOException; + +import ch.boye.httpclientandroidlib.util.CharArrayBuffer; + +/** + * Session output buffer for blocking connections. This interface is similar to + * OutputStream class, but it also provides methods for writing lines of text. + * <p> + * Implementing classes are also expected to manage intermediate data buffering + * for optimal output performance. + * + * @since 4.0 + */ +public interface SessionOutputBuffer { + + /** + * Writes <code>len</code> bytes from the specified byte array + * starting at offset <code>off</code> to this session buffer. + * <p> + * If <code>off</code> is negative, or <code>len</code> is negative, or + * <code>off+len</code> is greater than the length of the array + * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown. + * + * @param b the data. + * @param off the start offset in the data. + * @param len the number of bytes to write. + * @exception IOException if an I/O error occurs. + */ + void write(byte[] b, int off, int len) throws IOException; + + /** + * Writes <code>b.length</code> bytes from the specified byte array + * to this session buffer. + * + * @param b the data. + * @exception IOException if an I/O error occurs. + */ + void write(byte[] b) throws IOException; + + /** + * Writes the specified byte to this session buffer. + * + * @param b the <code>byte</code>. + * @exception IOException if an I/O error occurs. + */ + void write(int b) throws IOException; + + /** + * Writes characters from the specified string followed by a line delimiter + * to this session buffer. + * <p> + * The choice of a char encoding and line delimiter sequence is up to the + * specific implementations of this interface. + * + * @param s the line. + * @exception IOException if an I/O error occurs. + */ + void writeLine(String s) throws IOException; + + /** + * Writes characters from the specified char array followed by a line + * delimiter to this session buffer. + * <p> + * The choice of a char encoding and line delimiter sequence is up to the + * specific implementations of this interface. + * + * @param buffer the buffer containing chars of the line. + * @exception IOException if an I/O error occurs. + */ + void writeLine(CharArrayBuffer buffer) throws IOException; + + /** + * Flushes this session buffer and forces any buffered output bytes + * to be written out. The general contract of <code>flush</code> is + * that calling it is an indication that, if any bytes previously + * written have been buffered by the implementation of the output + * stream, such bytes should immediately be written to their + * intended destination. + * + * @exception IOException if an I/O error occurs. + */ + void flush() throws IOException; + + /** + * Returns {@link HttpTransportMetrics} for this session buffer. + * + * @return transport metrics. + */ + HttpTransportMetrics getMetrics(); + +} diff --git a/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/package-info.java b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/package-info.java new file mode 100644 index 000000000..8899c5ad6 --- /dev/null +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/io/package-info.java @@ -0,0 +1,32 @@ +/* + * ==================================================================== + * 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +/** + * HTTP message parser and writer APIs for synchronous, blocking + * communication. + */ +package ch.boye.httpclientandroidlib.io; |