Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
stringbuffer
- Page 1
Re: StringBuffer() & Performances
Programming
Software Development
15 Years Ago
by darkagn
StringBuffer
is certainly better in handling lots of operations than a …
StringBuffer and PrintStream
Programming
Software Development
15 Years Ago
by new_2_java
… the file into one single line. Is it
StringBuffer
behaviour? how can I write multiple lines to printStream….exit(STATUS); } } private void writeToLog (PrintStream logFile, String fileName,
StringBuffer
buffer) { try { out = new FileOutputStream(fileName); logFile = new PrintStream…
String & StringBuffer compatibility
Programming
Software Development
11 Years Ago
by rahul.ch
… String("Hello")); //Case 1
StringBuffer
sb1; //Case 2 String s = new String("Hello"); // …Case 2 sb1=s; //Case 2
StringBuffer
sb3; //Case 3 sb3 = new String("Hello");//Case…
StringBuffer() & Performances
Programming
Software Development
15 Years Ago
by k_en
… file. But my question is, how big or the size
stringbuffer
can store data? can it store more than 10000+ data… amount of data that i have been append to the
stringbuffer
before i write it in the text file and clear… the
stringbuffer
before continue to the next record? will this method be…
Re: StringBuffer and PrintStream
Programming
Software Development
15 Years Ago
by new_2_java
…, at least when I viewed in Notepad. [code=java]
StringBuffer
sb =new
StringBuffer
(); sb.append("First line\n"); sb.append…
Re: StringBuffer and PrintStream
Programming
Software Development
15 Years Ago
by Ezzaral
…[code]String newLine = System.getProperty("line.separator");
StringBuffer
sb =new
StringBuffer
(); sb.append("First line"); sb.append(newLine…
Re: StringBuffer() & Performances
Programming
Software Development
15 Years Ago
by Ezzaral
Why do you need to use a StringBuilder or
StringBuffer
prior to writing the data to a text file? Is … reason you can't just use a BufferedWriter? StringBuilder and
StringBuffer
are the preferred way to construct long strings from many…
Re: StringBuffer and PrintStream
Programming
Software Development
15 Years Ago
by Ezzaral
Not really sure why you are getting that behavior. Your writeToLog() code wrote a
StringBuffer
with newline characters in it to multiple lines just fine here in a tiny test program. Are you viewing the file with an editor that's okay with just linefeeds or does it expect carriage return and linefeed pairs?
Re: String & StringBuffer compatibility
Programming
Software Development
11 Years Ago
by JamesCherrill
String and
StringBuffer
have no "extends" relationship, so you can't assign or cast either to the other. Case 1 works because
StringBuffer
has a constructor that takes a String as parameter.
Re: String & StringBuffer compatibility
Programming
Software Development
11 Years Ago
by jalpesh_007
…, objects of type String are read only and immutable. The
StringBuffer
class is used to represent characters that can be modified… modify String(Word,sentence) if you have stored it in
StringBuffer
Object. So both have no relationship in between.
Re: StringBuffer Method..
Programming
Software Development
14 Years Ago
by MonicaClare
…String student, courses, answer, result="";
StringBuffer
name = new
StringBuffer
(""); name.append(","); String nameStr1 …;; String student,courses,answer,result="";
StringBuffer
name = new
StringBuffer
(""); name.append(""); String …
Re: StringBuffer Method..
Programming
Software Development
14 Years Ago
by VernonDozier
…am a little confused. You don't have any
StringBuffer
objects in this code, do you? I don'…saw the thread title, I figured you had a
StringBuffer
object, but it wasn't working and you … code, but again, you don't have any
StringBuffer
objects, so I'm not sure what you are… trying to do with a
StringBuffer
and where you are trying to do it.
Re: StringBuffer Method..
Programming
Software Development
14 Years Ago
by VernonDozier
…for helping me.. :D[/QUOTE] String, StringBuilder,
StringBuffer
are all kind of the same for something this…have one thread, so StringBuilder is faster than
StringBuffer
(
StringBuffer
is normally used when you have multiple threads).… like this. use whichever one (String, StringBuilder,
StringBuffer
) you are most comfortable with. It's just…
Re: about StringBuffer class
Programming
Software Development
11 Years Ago
by mvmalderen
…Java API: *This class provides an API compatible with
StringBuffer
, but with no guarantee of synchronization. This class … recommended that this class be used in preference to
StringBuffer
as it will be faster under most implementations.* …. Imagine two threads operating on a single shared
StringBuffer
. Threads can switch back and forth and there …
Java Hangman StringBuffer objects
Programming
Software Development
15 Years Ago
by snoh7
… a StrungBuffer for viewing the letters to be guessed
StringBuffer
wordLength =new
StringBuffer
(); for(int i=0; i= <= secretWord.length(); i… System.out.println(wordLength); //Creates a
StringBuffer
to display the guessed letters
StringBuffer
guessedLetters =new
StringBuffer
(); System.out.print("Enter a character…
Re: Java Hangman StringBuffer objects
Programming
Software Development
15 Years Ago
by snoh7
… a StrungBuffer for viewing the letters to be guessed
StringBuffer
word =new
StringBuffer
(); for(int i=0; i <= hangWord.length(); i…;); System.out.println(blankLetter); //Creates a
StringBuffer
to display the guessed letters
StringBuffer
guessedLetters =new
StringBuffer
(); System.out.print("Enter a character…
Problem whit load of xml file into Oracle using StringBuffer
Programming
Software Development
13 Years Ago
by DragonL
… a problem whit load of xml file into Oracle using
StringBuffer
. I get a java.sql.SQLException error “setString can…// xmlData is the string that contains the XML Data.
StringBuffer
buf = new
StringBuffer
(); try{ BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream…
about StringBuffer class
Programming
Software Development
11 Years Ago
by jalpesh_007
… capacity from 21 to 30 by using ensurecapacity() method.
StringBuffer
sb = new
StringBuffer
("hello"); System.out.println(sb.capacity());//output… we have created instance of this class with constructor
StringBuffer
sb = new
StringBuffer
(5); can anyone give me proper justification on it…
Re: about StringBuffer class
Programming
Software Development
11 Years Ago
by stultuske
how else would you create a
StringBuffer
instance? and yes, since ensureCapacity is not a static method, you'll need to have an instance of
StringBuffer
to call it on. [
StringBuffer
](http://docs.oracle.com/javase/7/docs/api/java/lang/
StringBuffer
.html)
Re: Java Hangman StringBuffer objects
Programming
Software Development
15 Years Ago
by Alex Edwards
You could just create your own collection-type, such as a linked list or a tree, to store your information. Edit: Also I think a
StringBuffer
is backed by an array for random-access character retrieval.
Re: Java Hangman StringBuffer objects
Programming
Software Development
15 Years Ago
by snoh7
Sorry i'm a bit of an amateur at Java programming so i'm not exactly sure what your post meant. Is there a way i could do it using
StringBuffer
methods as that is one of my assignment requirements? i just need to somehow replace for example _ _ _ _ _ _(street) and s is guess with s _ _ _ _ _ Thanks for your speedy reply, appreciate it
Re: about StringBuffer class
Programming
Software Development
11 Years Ago
by bguild
The capacity 44 is two plus twice the old capacity of 21. In other words `sb.capacity() = 44 = 2 * 21 + 2`. That's what the documentation for `ensureCapacity` says it should be. I hope everyone is aware that `StringBuilder` is superior to `
StringBuffer
`.
How to split StringBuffer in J2ME
Programming
Mobile Development
13 Years Ago
by Hakoo
… code is : [CODE] HttpConnection conn = (HttpConnection) Connector.open(url);
StringBuffer
sb = new
StringBuffer
(); conn.setRequestMethod(HttpConnection.GET); conn.setRequestProperty("Content-Type…
Re: StringBuffer and PrintStream
Programming
Software Development
15 Years Ago
by new_2_java
Thanks, that did the trick. Appreciate your help.
Re: StringBuffer and PrintStream
Programming
Software Development
14 Years Ago
by svdurgarao
[QUOTE=new_2_java;635156]Thanks, that did the trick. Appreciate your help.[/QUOTE] Thanks for your supprt, its really helped me to format my output string
Re: StringBuffer and PrintStream
Programming
Software Development
14 Years Ago
by kvprajapati
I'm glad you got it helpful. If you want to ask question, start your own thread. Thread Closed.
Re: StringBuffer() & Performances
Programming
Software Development
15 Years Ago
by jwenting
It's often preferably to collate data before writing it out to disk. That way you can write larger chunks at once, reducing the number of physical disk operations (which improves performance).
Re: StringBuffer() & Performances
Programming
Software Development
15 Years Ago
by Ezzaral
Yes, good point, I would certainly agree there. The poster didn't give much detail on his process, so it's tough to say what the most efficient arrangement would be.
Re: String & StringBuffer compatibility
Programming
Software Development
11 Years Ago
by rahul.ch
Thanks guys!
Re: String vs Stringbuffer
Programming
Software Development
13 Years Ago
by masijade
P.S. unless the spot where you're using a
StringBuffer
is "thread" sensitive, use a StringBuilder rather than a
StringBuffer
. A
StringBuffer
is "synchronized" whereas a StringBuilder is not, making a StringBuilder more performant when synchronization is not an issue.
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC