[vlma-devel] commit: Replace StringBuffer with StringBuilder. (Adrien Grand )

git version control git at videolan.org
Wed Aug 20 21:48:10 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Wed Aug 20 20:35:25 2008 +0200| [0eec6492e24ed94161ead30660175a871ba7d242] | committer: Adrien Grand 

Replace StringBuffer with StringBuilder.

Since every StringBuffer is used by a single thread, there is no need for
synchronization, so StringBuilder may be a better choice.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=0eec6492e24ed94161ead30660175a871ba7d242
---

 .../org/videolan/vlma/order/FilesOrderSender.java  |    2 +-
 .../java/org/videolan/vlma/order/OrderSender.java  |    2 +-
 .../org/videolan/vlma/order/SatOrderSender.java    |    4 ++--
 .../org/videolan/vlma/order/StreamOrderSender.java |    2 +-
 .../org/videolan/vlma/order/TNTOrderSender.java    |    4 ++--
 .../vlma/watcher/ExtremeStreamWatcher.java         |    2 +-
 .../configuration/ConfigurationEditController.java |    2 +-
 .../web/media/file/FileChannelEditController.java  |    2 +-
 .../web/satellite/SatelliteEditController.java     |    2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/FilesOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/FilesOrderSender.java
index 9cb11f6..ba1c19c 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/FilesOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/FilesOrderSender.java
@@ -46,7 +46,7 @@ public class FilesOrderSender extends OrderSender {
                 telnetCommand("setup " + commandName + " input \"" + file_path + "\"", o.getAdapter());
             }
 
-            StringBuffer output = new StringBuffer();
+            StringBuilder output = new StringBuilder();
             output.append(String.format("#standard{mux=%s,access=%s,dst=%s", getMux(ch.getProgram()), getAccess(ch.getProgram()), getDst(ch.getProgram())));
             if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
index 41c0a3e..4cdd36b 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
@@ -108,7 +108,7 @@ public abstract class OrderSender {
                 } catch (InterruptedException e) {
                 }
             }
-            StringBuffer response = new StringBuffer();
+            StringBuilder response = new StringBuilder();
             while (telnetIn.ready()) {
                 response.append((char) telnetIn.read());
             }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
index dc37807..a9efa51 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
@@ -54,8 +54,8 @@ public class SatOrderSender extends OrderSender {
             telnetCommand("setup " + getVLMCommandName(o)
                     + " option dvb-srate=" + ch.getSymbolRate(), o.getAdapter());
 
-            StringBuffer ids = new StringBuffer();
-            StringBuffer command = new StringBuffer();
+            StringBuilder ids = new StringBuilder();
+            StringBuilder command = new StringBuilder();
             for (Media m : o.getMedias()) {
                 ch = (SatChannel) m;
                 if (ids.length() > 0) {
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/StreamOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/StreamOrderSender.java
index aa1b550..c8b4aef 100755
--- a/vlma-core/src/main/java/org/videolan/vlma/order/StreamOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/StreamOrderSender.java
@@ -43,7 +43,7 @@ public class StreamOrderSender extends OrderSender {
             telnetCommand("setup " + commandName + " input \"" + ch.getStreamURL()
                     + "\"", o.getAdapter());
 
-            StringBuffer output = new StringBuffer();
+            StringBuilder output = new StringBuilder();
             output.append(String.format("#standard{mux=%s,access=%s,dst=%s", getMux(ch.getProgram()),getAccess(ch.getProgram()), getDst(ch.getProgram())));
             if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
index b4836b7..ded03e8 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
@@ -44,8 +44,8 @@ public class TNTOrderSender extends OrderSender {
             telnetCommand("setup " + getVLMCommandName(o)  + " option dvb-bandwidth="
                     + Integer.toString(configuration.getInt("vlc.stream.dvb-bandwidth")),
                     o.getAdapter());
-            StringBuffer ids = new StringBuffer();
-            StringBuffer command = new StringBuffer();
+            StringBuilder ids = new StringBuilder();
+            StringBuilder command = new StringBuilder();
             for (Media m : o.getMedias()) {
                 ch = (TNTChannel) m;
                 if (ids.length() > 0) {
diff --git a/vlma-core/src/main/java/org/videolan/vlma/watcher/ExtremeStreamWatcher.java b/vlma-core/src/main/java/org/videolan/vlma/watcher/ExtremeStreamWatcher.java
index 4148f42..6fe31f6 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/watcher/ExtremeStreamWatcher.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/watcher/ExtremeStreamWatcher.java
@@ -83,7 +83,7 @@ public class ExtremeStreamWatcher implements StreamWatcher, Serializable {
 
     public boolean isPlayed(Program program) {
         boolean result = false;
-        StringBuffer toParse = new StringBuffer();
+        StringBuilder toParse = new StringBuilder();
         logger.debug("Connect to the router to get the stream state.");
         try {
             // Create socket and connection
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEditController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEditController.java
index a73086e..153aec2 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEditController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEditController.java
@@ -87,7 +87,7 @@ public class ConfigurationEditController extends SimpleFormController {
     }
 
     private static String listToString(List list) {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         for(Object o : list) {
             if(!"".equals(o.toString()))
                 result.append(",").append(o.toString());
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
index eb6c1eb..967166b 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
@@ -73,7 +73,7 @@ public class FileChannelEditController extends SimpleFormController {
         Server server = ((FilesChannel)media).getServer();
         filesChannelsAdd.setServer(server == null ? null : String.valueOf(server.getId()));
 
-        StringBuffer filesList = new StringBuffer();
+        StringBuilder filesList = new StringBuilder();
         for (String file : ((FilesChannel)media).getFiles()) {
             filesList.append(file).append("\n");
         }
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/satellite/SatelliteEditController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/satellite/SatelliteEditController.java
index de1ce3c..354c660 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/satellite/SatelliteEditController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/satellite/SatelliteEditController.java
@@ -65,7 +65,7 @@ public class SatelliteEditController extends SimpleFormController {
         Satellite satellite = data.getSatellite(id);
         if (satellite != null) {
             satellitesAdd.setName(satellite.getName());
-            StringBuffer coverages = new StringBuffer();
+            StringBuilder coverages = new StringBuilder();
             for (String coverage : satellite.getCoverages()) {
                 coverages.append(coverage);
                 coverages.append('\n');



More information about the vlma-devel mailing list