From e67a50c904e054d431a8a5178a6c766472b56ace Mon Sep 17 00:00:00 2001 From: Emmanuel Bourg Date: Fri, 15 Nov 2013 23:11:08 +0100 Subject: [PATCH] Replaced StringBuffers with StringBuilders --- .../alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo.java | 2 +- .../com/sun/jna/contrib/demo/AlphaMaskDemo2.java | 2 +- .../com/sun/jna/contrib/demo/FilteredTextField.java | 4 ++-- .../platform/src/com/sun/jna/platform/win32/Advapi32Util.java | 2 +- src/com/sun/jna/Native.java | 2 +- test/com/sun/jna/NativeTest.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo.java b/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo.java index 79cbac4db5..9f1eb0a5c5 100644 --- a/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo.java +++ b/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo.java @@ -438,7 +438,7 @@ public boolean importData(JComponent comp, Transferable t) { if (flavor != null) { Reader reader = flavor.getReaderForText(t); char[] buf = new char[512]; - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); int count; // excise excess NUL characters (bug in firefox, java // or my code, not sure which). someone got the diff --git a/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo2.java b/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo2.java index 216e593319..f3617c2666 100644 --- a/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo2.java +++ b/contrib/alphamaskdemo/com/sun/jna/contrib/demo/AlphaMaskDemo2.java @@ -200,7 +200,7 @@ public boolean importData(JComponent comp, Transferable t) { if (flavor != null) { Reader reader = flavor.getReaderForText(t); char[] buf = new char[512]; - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); int count; // excise excess NUL characters (bug in firefox, // java diff --git a/contrib/balloontips/com/sun/jna/contrib/demo/FilteredTextField.java b/contrib/balloontips/com/sun/jna/contrib/demo/FilteredTextField.java index a7955303c6..90657a8330 100644 --- a/contrib/balloontips/com/sun/jna/contrib/demo/FilteredTextField.java +++ b/contrib/balloontips/com/sun/jna/contrib/demo/FilteredTextField.java @@ -256,8 +256,8 @@ public void insertString (int offset, String str, AttributeSet a) balloon.hide(); } } - StringBuffer buffer = - new StringBuffer(FilteredTextField.this.getText()); + StringBuilder buffer = + new StringBuilder(FilteredTextField.this.getText()); if (offset >= 0 && offset <= buffer.length()) { buffer.insert(offset, str); String strBuf = buffer.toString(); diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java index de69521deb..10d017ec4a 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java @@ -1747,7 +1747,7 @@ public EnumKey(HKEY hKey, int dwIndex) { * @return A environment block */ public static String getEnvironmentBlock(Map environment) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); for (Entry entry : environment.entrySet()) { if (entry.getValue() != null) { out.append(entry.getKey() + "=" + entry.getValue() + "\0"); diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java index 7163c84c7a..6bdf0db2dd 100644 --- a/src/com/sun/jna/Native.java +++ b/src/com/sun/jna/Native.java @@ -1272,7 +1272,7 @@ private static String getSignature(Class cls) { // No String.replace available in 1.4 static String replace(String s1, String s2, String str) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); while (true) { int idx = str.indexOf(s1); if (idx == -1) { diff --git a/test/com/sun/jna/NativeTest.java b/test/com/sun/jna/NativeTest.java index a946ca8d90..c3f22df3a4 100644 --- a/test/com/sun/jna/NativeTest.java +++ b/test/com/sun/jna/NativeTest.java @@ -28,7 +28,7 @@ public class NativeTest extends TestCase { private static final String UNICODE = "[\u0444]"; public void testLongStringGeneration() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); final int MAX = Platform.isWindowsCE() ? 200000 : 2000000; for (int i=0;i < MAX;i++) { buf.append('a');