You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/18 16:48:55 UTC

[commons-vfs] branch master updated: Clean up API names for package-private class.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 9164afd  Clean up API names for package-private class.
9164afd is described below

commit 9164afd1c4b7d089878d9c9be253b9e21e8594b7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 18 11:48:50 2021 -0500

    Clean up API names for package-private class.
---
 .../commons/vfs2/provider/DefaultFileContent.java  | 16 +++++------
 .../vfs2/provider/FileContentThreadData.java       | 32 +++++++++-------------
 .../commons/vfs2/util/MonitorOutputStream.java     |  2 +-
 3 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
index 1797b51..8f47cd2 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
@@ -461,7 +461,7 @@ public final class DefaultFileContent implements FileContent {
             // Close the randomAccess stream
             while (threadData.hasRandomAccessContent()) {
                 final FileRandomAccessContent randomAccessContent = (FileRandomAccessContent) threadData
-                        .removeRastr(0);
+                        .removeRandomAccessContent(0);
                 try {
                     randomAccessContent.close();
                 } catch (final FileSystemException ex) {
@@ -470,9 +470,9 @@ public final class DefaultFileContent implements FileContent {
             }
 
             // Close the output stream
-            final FileContentOutputStream outputStream = threadData.getFileContentOutputStream();
+            final FileContentOutputStream outputStream = threadData.getOutputStream();
             if (outputStream != null) {
-                threadData.setFileContentOutputStream(null);
+                threadData.setOutputStream(null);
                 try {
                     outputStream.close();
                 } catch (final FileSystemException ex) {
@@ -529,7 +529,7 @@ public final class DefaultFileContent implements FileContent {
          */
         final FileContentThreadData threadData = getFileContentThreadData();
 
-        if (threadData.getFileContentOutputStream() != null) {
+        if (threadData.getOutputStream() != null) {
             throw new FileSystemException("vfs.provider/write-in-use.error", fileObject);
         }
 
@@ -540,7 +540,7 @@ public final class DefaultFileContent implements FileContent {
         final FileContentOutputStream wrapped = bufferSize == 0 ?
             new FileContentOutputStream(fileObject, outstr) :
             new FileContentOutputStream(fileObject, outstr, bufferSize);
-        threadData.setFileContentOutputStream(wrapped);
+        threadData.setOutputStream(wrapped);
         streamOpened();
 
         return wrapped;
@@ -552,7 +552,7 @@ public final class DefaultFileContent implements FileContent {
     private void endInput(final InputStream instr) {
         final FileContentThreadData fileContentThreadData = threadLocal.get();
         if (fileContentThreadData != null) {
-            fileContentThreadData.removeInstr(instr);
+            fileContentThreadData.remove(instr);
         }
         if (fileContentThreadData == null || !fileContentThreadData.hasStreams()) {
             // remove even when no value is set to remove key
@@ -567,7 +567,7 @@ public final class DefaultFileContent implements FileContent {
     private void endRandomAccess(final RandomAccessContent rac) {
         final FileContentThreadData fileContentThreadData = threadLocal.get();
         if (fileContentThreadData != null) {
-            fileContentThreadData.removeRastr(rac);
+            fileContentThreadData.remove(rac);
         }
         if (fileContentThreadData == null || !fileContentThreadData.hasStreams()) {
             // remove even when no value is set to remove key
@@ -582,7 +582,7 @@ public final class DefaultFileContent implements FileContent {
     private void endOutput() throws Exception {
         final FileContentThreadData fileContentThreadData = threadLocal.get();
         if (fileContentThreadData != null) {
-            fileContentThreadData.setFileContentOutputStream(null);
+            fileContentThreadData.setOutputStream(null);
         }
         if (fileContentThreadData == null || !fileContentThreadData.hasStreams()) {
             // remove even when no value is set to remove key
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java
index c874b13..c0379f5 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java
@@ -27,8 +27,6 @@ import org.apache.commons.vfs2.RandomAccessContent;
  */
 class FileContentThreadData {
 
-    // private int state = DefaultFileContent.STATE_CLOSED;
-
     private ArrayList<InputStream> inputStreamList;
     private ArrayList<RandomAccessContent> randomAccessContentList;
     private DefaultFileContent.FileContentOutputStream outputStream;
@@ -36,12 +34,6 @@ class FileContentThreadData {
     FileContentThreadData() {
     }
 
-    /*
-     * int getState() { return state; }
-     *
-     * void setState(int state) { this.state = state; }
-     */
-
     void add(final InputStream inputStream) {
         if (this.inputStreamList == null) {
             this.inputStreamList = new ArrayList<>();
@@ -56,12 +48,18 @@ class FileContentThreadData {
         this.randomAccessContentList.add(randomAccessContent);
     }
 
-    public void closeOutstr() throws FileSystemException {
+    /**
+     * Closes the output stream.
+     *
+     * @throws FileSystemException if an IO error occurs.
+     * @@since 2.8.0
+     */
+    void closeOutputStream() throws FileSystemException {
         outputStream.close();
         outputStream = null;
     }
 
-    DefaultFileContent.FileContentOutputStream getFileContentOutputStream() {
+    DefaultFileContent.FileContentOutputStream getOutputStream() {
         return this.outputStream;
     }
 
@@ -73,7 +71,7 @@ class FileContentThreadData {
         return randomAccessContentList != null && !randomAccessContentList.isEmpty();
     }
 
-    public boolean hasStreams() {
+    boolean hasStreams() {
         return hasInputStream() || outputStream != null || hasRandomAccessContent();
     }
 
@@ -81,23 +79,19 @@ class FileContentThreadData {
         return this.inputStreamList.remove(pos);
     }
 
-    public void removeInstr(final InputStream inputStream) {
+    void remove(final InputStream inputStream) {
         this.inputStreamList.remove(inputStream);
     }
 
-    public Object removeInstr(final int pos) {
-        return this.inputStreamList.remove(pos);
-    }
-
-    public Object removeRastr(final int pos) {
+    Object removeRandomAccessContent(final int pos) {
         return this.randomAccessContentList.remove(pos);
     }
 
-    public void removeRastr(final RandomAccessContent randomAccessContent) {
+    void remove(final RandomAccessContent randomAccessContent) {
         this.randomAccessContentList.remove(randomAccessContent);
     }
 
-    void setFileContentOutputStream(final DefaultFileContent.FileContentOutputStream outputStream) {
+    void setOutputStream(final DefaultFileContent.FileContentOutputStream outputStream) {
         this.outputStream = outputStream;
     }
 }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java
index d28e673..43ad530 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java
@@ -60,7 +60,7 @@ public class MonitorOutputStream extends BufferedOutputStream {
      * This does nothing if the stream is closed already.
      * </p>
      *
-     * @throws IOException if an error occurs.
+     * @throws IOException if an IO error occurs.
      */
     @Override
     public void close() throws IOException {