[guava-libraries] 01/03: Reimplemented the Input/OutputSupplier interfaces in ByteSource/Sink and CharSource/Sink

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Thu Jun 4 18:13:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository guava-libraries.

commit 130347dc440c2efd7c324c5e3ed99a2b8601636c
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Thu Jun 4 17:45:48 2015 +0200

    Reimplemented the Input/OutputSupplier interfaces in ByteSource/Sink and CharSource/Sink
---
 debian/changelog                                   |   8 ++
 .../patches/06-preserve-pre-guava18-methods.patch  | 132 +++++++++++++++++++++
 2 files changed, 140 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index e1dd394..2981cfe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+guava-libraries (18.0-2) UNRELEASED; urgency=medium
+
+  * Improved the backward compatibility:
+    - Reimplemented the InputSupplier and OutputSupplier interfaces
+      in the ByteSource, ByteSink, CharSource and CharSink classes
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Thu, 04 Jun 2015 17:39:06 +0200
+
 guava-libraries (18.0-1) unstable; urgency=medium
 
   * New upstream release (Closes: #775686)
diff --git a/debian/patches/06-preserve-pre-guava18-methods.patch b/debian/patches/06-preserve-pre-guava18-methods.patch
index f0c2514..319eccd 100644
--- a/debian/patches/06-preserve-pre-guava18-methods.patch
+++ b/debian/patches/06-preserve-pre-guava18-methods.patch
@@ -503,3 +503,135 @@ Forwarded: not-needed
 +    return (OutputSupplier) checkNotNull(sink);
 +  }
  }
+--- a/guava/src/com/google/common/io/ByteSource.java
++++ b/guava/src/com/google/common/io/ByteSource.java
+@@ -56,7 +56,7 @@
+  * @since 14.0
+  * @author Colin Decker
+  */
+-public abstract class ByteSource {
++public abstract class ByteSource implements InputSupplier<InputStream> {
+ 
+   private static final int BUF_SIZE = 0x1000; // 4K
+ 
+@@ -84,6 +84,21 @@
+   public abstract InputStream openStream() throws IOException;
+ 
+   /**
++   * This method is a temporary method provided for easing migration from suppliers to sources and
++   * sinks.
++   *
++   * @since 15.0
++   * @deprecated This method is only provided for temporary compatibility with the
++   *     {@link InputSupplier} interface and should not be called directly. Use {@link #openStream}
++   *     instead. This method is scheduled for removal in Guava 18.0.
++   */
++  @Override
++  @Deprecated
++  public final InputStream getInput() throws IOException {
++    return openStream();
++  }
++
++  /**
+    * Opens a new buffered {@link InputStream} for reading from this source. The returned stream is
+    * not required to be a {@link BufferedInputStream} in order to allow implementations to simply
+    * delegate to {@link #openStream()} when the stream returned by that method does not benefit
+--- a/guava/src/com/google/common/io/ByteSink.java
++++ b/guava/src/com/google/common/io/ByteSink.java
+@@ -44,7 +44,7 @@
+  * @since 14.0
+  * @author Colin Decker
+  */
+-public abstract class ByteSink {
++public abstract class ByteSink implements OutputSupplier<OutputStream> {
+ 
+   /**
+    * Constructor for use by subclasses.
+@@ -70,6 +70,21 @@
+   public abstract OutputStream openStream() throws IOException;
+ 
+   /**
++   * This method is a temporary method provided for easing migration from suppliers to sources and
++   * sinks.
++   *
++   * @since 15.0
++   * @deprecated This method is only provided for temporary compatibility with the
++   *     {@link OutputSupplier} interface and should not be called directly. Use
++   *     {@link #openStream} instead. This method is scheduled for removal in Guava 18.0.
++   */
++  @Override
++  @Deprecated
++  public final OutputStream getOutput() throws IOException {
++    return openStream();
++  }
++
++  /**
+    * Opens a new buffered {@link OutputStream} for writing to this sink. The returned stream is
+    * not required to be a {@link BufferedOutputStream} in order to allow implementations to simply
+    * delegate to {@link #openStream()} when the stream returned by that method does not benefit
+--- a/guava/src/com/google/common/io/CharSink.java
++++ b/guava/src/com/google/common/io/CharSink.java
+@@ -46,7 +46,7 @@
+  * @since 14.0
+  * @author Colin Decker
+  */
+-public abstract class CharSink {
++public abstract class CharSink implements OutputSupplier<Writer> {
+ 
+   /**
+    * Constructor for use by subclasses.
+@@ -64,6 +64,21 @@
+   public abstract Writer openStream() throws IOException;
+ 
+   /**
++   * This method is a temporary method provided for easing migration from suppliers to sources and
++   * sinks.
++   *
++   * @since 15.0
++   * @deprecated This method is only provided for temporary compatibility with the
++   *     {@link OutputSupplier} interface and should not be called directly. Use
++   *     {@link #openStream} instead. This method is scheduled for removal in Guava 18.0.
++   */
++  @Override
++  @Deprecated
++  public final Writer getOutput() throws IOException {
++    return openStream();
++  }
++
++  /**
+    * Opens a new buffered {@link Writer} for writing to this sink. The returned stream is not
+    * required to be a {@link BufferedWriter} in order to allow implementations to simply delegate
+    * to {@link #openStream()} when the stream returned by that method does not benefit from
+--- a/guava/src/com/google/common/io/CharSource.java
++++ b/guava/src/com/google/common/io/CharSource.java
+@@ -62,7 +62,7 @@
+  * @since 14.0
+  * @author Colin Decker
+  */
+-public abstract class CharSource {
++public abstract class CharSource implements InputSupplier<Reader> {
+ 
+   /**
+    * Constructor for use by subclasses.
+@@ -80,6 +80,21 @@
+   public abstract Reader openStream() throws IOException;
+ 
+   /**
++   * This method is a temporary method provided for easing migration from suppliers to sources and
++   * sinks.
++   *
++   * @since 15.0
++   * @deprecated This method is only provided for temporary compatibility with the
++   *     {@link InputSupplier} interface and should not be called directly. Use {@link #openStream}
++   *     instead. This method is scheduled for removal in Guava 18.0.
++   */
++  @Override
++  @Deprecated
++  public final Reader getInput() throws IOException {
++    return openStream();
++  }
++
++  /**
+    * Opens a new {@link BufferedReader} for reading from this source. This method should return a
+    * new, independent reader each time it is called.
+    *

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/guava-libraries.git



More information about the pkg-java-commits mailing list