Java 类java.lang.StringBuilder 实例源码

项目:MoparScape    文件:Player.java   
static public String getContents(File aFile) {

        StringBuilder contents = new StringBuilder();

        try {
            BufferedReader input = new BufferedReader(new FileReader(aFile));
            try {
                String line = null;

                while ((line = input.readLine()) != null) {
                    contents.append(line);

                }
            }
            finally {
                input.close();
            }
        }
        catch (IOException ex) {

        }
        return contents.toString();
    }
项目:buildAPKsSamples    文件:HelloSpellCheckerActivity.java   
private void dumpSuggestionsInfoInternal(
        final StringBuilder sb, final SuggestionsInfo si, final int length, final int offset) {
    // Returned suggestions are contained in SuggestionsInfo
    final int len = si.getSuggestionsCount();
    sb.append('\n');
    for (int j = 0; j < len; ++j) {
        if (j != 0) {
            sb.append(", ");
        }
        sb.append(si.getSuggestionAt(j));
    }
    sb.append(" (" + len + ")");
    if (length != NOT_A_LENGTH) {
        sb.append(" length = " + length + ", offset = " + offset);
    }
}
项目:buildAPKsSamples    文件:HelloSpellCheckerActivity.java   
/**
 * Callback for {@link SpellCheckerSession#getSentenceSuggestions(TextInfo[], int)}
 * @param results an array of {@link SentenceSuggestionsInfo}s.
 * These results are suggestions for {@link TextInfo}s
 * queried by {@link SpellCheckerSession#getSentenceSuggestions(TextInfo[], int)}.
 */
@Override
public void onGetSentenceSuggestions(final SentenceSuggestionsInfo[] arg0) {
    if (!isSentenceSpellCheckSupported()) {
        Log.e(TAG, "Sentence spell check is not supported on this platform, "
                + "but accidentially called.");
        return;
    }
    Log.d(TAG, "onGetSentenceSuggestions");
    final StringBuilder sb = new StringBuilder();
    for (int i = 0; i < arg0.length; ++i) {
        final SentenceSuggestionsInfo ssi = arg0[i];
        for (int j = 0; j < ssi.getSuggestionsCount(); ++j) {
            dumpSuggestionsInfoInternal(
                    sb, ssi.getSuggestionsInfoAt(j), ssi.getOffsetAt(j), ssi.getLengthAt(j));
        }
    }
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mMainView.append(sb.toString());
        }
    });
}
项目:writing-compiler-for-neophytes    文件:DFA.java   
/** Методы Object */
@Override public String toString() { 
    StringBuilder result=new StringBuilder();
    for(int n=0; n<this.transitions.size(); n++) {
        result.append("#");
        result.append(this.stateNames.get(n));
        Set<F> markers=this.markers.get(n);
        if(!markers.isEmpty()) {
            boolean first=true;
            for(F marker: markers)
                if(first) {
                    first=false;
                    result.append(String.format(":%s", marker));
                } else result.append(String.format(" %s", marker));
        };
        result.append(":");
        for(Map.Entry<P,State> entry: this.transitions.get(n).entrySet()) {
            P symbol=entry.getKey();
            if(symbol!=null) result.append(String.format(" %s→%d", symbol, entry.getValue().getId()));
            else result.append(String.format(" ε→%d", entry.getValue().getId()));
        };
        result.append("\n");
    };
    return result.toString();
}
项目:ChatModerator    文件:ViolationPreWarningListener.java   
@EventHandler
public void handleWarningMessage(WarningSendEvent event) {
    Violation violation = event.getParent().getViolation();

    if (WARNABLE_VIOLATIONS.contains(violation.getClass())) {
        StringBuilder message = new StringBuilder(ChatColor.RED.toString());
        if (violation.getClass() == DuplicateMessageViolation.class) {
            message.append("This message was not sent because you are sending the same message too fast.");
        } else {
            message.append("This message was not sent to ")
                   .append(violation.isForceNoSend() ? "any" : "some")
                   .append(" players because it contained potentially offensive content.");
        }

        event.setMessage(message.toString());
    } else {
        event.setMessage(null);
    }
}
项目:cassandra-count    文件:CqlCount.java   
private PreparedStatement prepareStatement() {
List<ColumnMetadata> partkeys = cluster.getMetadata().getKeyspace(keyspaceName).getTable(tableName).getPartitionKey();
StringBuilder sb = new StringBuilder();
sb.append("SELECT COUNT(*) FROM ");
sb.append(keyspaceName).append(".").append(tableName);
sb.append(" WHERE Token(");
sb.append(partkeys.get(0).getName());
for (int i = 1; i < partkeys.size(); i++)
    sb.append(", ").append(partkeys.get(i).getName());
sb.append(") > ? AND Token(");
sb.append(partkeys.get(0).getName());
for (int i = 1; i < partkeys.size(); i++)
    sb.append(",").append(partkeys.get(i).getName());
sb.append(") <= ?");

debugPrint("Query: " + sb.toString(), true, 2);

return session.prepare(sb.toString()).setConsistencyLevel(consistencyLevel);
   }
项目:gemfirexd-oss    文件:DbFile.java   
/**
  Create a string that contains a representation of the content of
  a file for testing.
  @exception Exception Oops.
  */
public static String
stringFromFile(InputStream is)
     throws Exception
{
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br =
        new BufferedReader(isr);
    StringBuilder sb = new StringBuilder();
    String l;
    while((l = br.readLine()) != null) {
        sb.append(l);
        sb.append("<CR>");
    }
    is.close();
    return sb.toString();
}
项目:fsharpadvent2016    文件:LispReader.java   
static private Object readNumber(PushbackReader r, char initch) {
    StringBuilder sb = new StringBuilder();
    sb.append(initch);

    for(; ;)
        {
        int ch = read1(r);
        if(ch == -1 || isWhitespace(ch) || isMacro(ch))
            {
            unread(r, ch);
            break;
            }
        sb.append((char) ch);
        }

    String s = sb.toString();
    Object n = matchNumber(s);
    if(n == null)
        throw new NumberFormatException("Invalid number: " + s);
    return n;
}
项目:fsharpadvent2016    文件:LispReader.java   
public Object invoke(Object reader, Object doublequote, Object opts, Object pendingForms) {
    StringBuilder sb = new StringBuilder();
    Reader r = (Reader) reader;
    for(int ch = read1(r); ch != '"'; ch = read1(r))
        {
        if(ch == -1)
            throw Util.runtimeException("EOF while reading regex");
        sb.append( (char) ch );
        if(ch == '\\')  //escape
            {
            ch = read1(r);
            if(ch == -1)
                throw Util.runtimeException("EOF while reading regex");
            sb.append( (char) ch ) ;
            }
        }
    return Pattern.compile(sb.toString());
}
项目:eclojure    文件:LispReader.java   
static private Object readNumber(PushbackReader r, char initch) {
    StringBuilder sb = new StringBuilder();
    sb.append(initch);

    for(; ;)
        {
        int ch = read1(r);
        if(ch == -1 || isWhitespace(ch) || isMacro(ch))
            {
            unread(r, ch);
            break;
            }
        sb.append((char) ch);
        }

    String s = sb.toString();
    Object n = matchNumber(s);
    if(n == null)
        throw new NumberFormatException("Invalid number: " + s);
    return n;
}
项目:eclojure    文件:LispReader.java   
public Object invoke(Object reader, Object doublequote, Object opts, Object pendingForms) {
    StringBuilder sb = new StringBuilder();
    Reader r = (Reader) reader;
    for(int ch = read1(r); ch != '"'; ch = read1(r))
        {
        if(ch == -1)
            throw Util.runtimeException("EOF while reading regex");
        sb.append( (char) ch );
        if(ch == '\\')  //escape
            {
            ch = read1(r);
            if(ch == -1)
                throw Util.runtimeException("EOF while reading regex");
            sb.append( (char) ch ) ;
            }
        }
    return Pattern.compile(sb.toString());
}
项目:kafka-connect-s3    文件:S3WriterTest.java   
private void verifyStringPut(AmazonS3 mock, String key, String content) throws Exception {
  ArgumentCaptor<PutObjectRequest> argument
    = ArgumentCaptor.forClass(PutObjectRequest.class);
  verify(mock)
    .putObject(argument.capture());

  PutObjectRequest req = argument.getValue();
  assertEquals(key, req.getKey());
  assertEquals(this.testBucket, req.getBucketName());

  InputStreamReader input = new InputStreamReader(req.getInputStream(), "UTF-8");
  StringBuilder sb = new StringBuilder(1024);
  final char[] buffer = new char[1024];
  try {
    for(int read = input.read(buffer, 0, buffer.length);
            read != -1;
            read = input.read(buffer, 0, buffer.length)) {
      sb.append(buffer, 0, read);
    }
  } catch (IOException ignore) { }

  assertEquals(content, sb.toString());
}
项目:metrics-circonus    文件:TaggedName.java   
public String encode() {
  if (!encodedTags.isEmpty()) {
    StringBuilder sb = new StringBuilder(this.metricName);
    sb.append('[');
    String prefix = "";
    for (String encodedTag : encodedTags) {
      sb.append(prefix);
      sb.append(encodedTag);
      prefix = ",";
    }
    sb.append(']');
    return sb.toString();
  } else {
    return this.metricName;
  }
}
项目:jdbc-driver    文件:SparkAQL.java   
/**
* Reformats the query to insert a LIMIT 1 prior to a Time constraint
*/
private static String getSchemaQuery(final String query)
{
  String stmt = getSchemaCoreQuery(query);
  List<String> tokens = tokenize(stmt);
  StringBuilder newQuery = new StringBuilder();
  boolean addedLimit = false;
  for (int indx = 0; indx < tokens.size(); indx++) {
    if (tokens.get(indx).trim().equalsIgnoreCase("limit")) {
      newQuery.append("LIMIT 1 ");
      indx++;
      addedLimit = true;
    } else if (tokens.get(indx).trim().equalsIgnoreCase("start")) {
      if (!addedLimit) {
        newQuery.append("LIMIT 1 ");
        newQuery.append(tokens.get(indx));
        addedLimit = true;
      } else
        newQuery.append(tokens.get(indx));
    } else
      newQuery.append(tokens.get(indx));
  }
  return newQuery.toString();
}
项目:canopy-clustering    文件:NetflixKMeansIterViewer.java   
public void reduce(WritableComparable key, Iterator values,
        OutputCollector output, Reporter reporter) throws IOException {
    int count = 0;
    StringBuilder builder = new StringBuilder();
    while(values.hasNext()) {
        count += 1;
        if(count > 10000)
            break;
        String data = ((Text)values.next()).toString();
        int index = data.indexOf(":");
        String movie_id = data.substring(0, index);
        if(movieTitles.containsKey(movie_id)) {
            builder.append(movieTitles.get(movie_id));
            builder.append("\t");
        }
    }
    output.collect(key, new Text(builder.toString()));
}
项目:canopy-clustering    文件:GraphBuilderMapper.java   
public void map(WritableComparable key, Writable value,
                OutputCollector output, Reporter reporter) throws IOException {
  // Prepare the input data.
  String page = value.toString();

  System.out.println("Page:" + page);
  String title = this.GetTitle(page, reporter);
  if (title.length() > 0) {
    reporter.setStatus(title);
  } else {
    return;
  }

  ArrayList<String> outlinks = this.GetOutlinks(page);
  StringBuilder builder = new StringBuilder();
  for (String link : outlinks) {
    link = link.replace(" ", "_");
    builder.append(" ");
    builder.append(link);
  }
  output.collect(new Text(title), new Text(builder.toString()));
}
项目:gemfirexd-oss    文件:DbFile.java   
/**
  Create a string that contains a representation of the content of
  a file for testing.
  @exception Exception Oops.
  */
public static String
stringFromFile(InputStream is)
     throws Exception
{
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br =
        new BufferedReader(isr);
    StringBuilder sb = new StringBuilder();
    String l;
    while((l = br.readLine()) != null) {
        sb.append(l);
        sb.append("<CR>");
    }
    is.close();
    return sb.toString();
}
项目:JAVA-Overview    文件:threadAndRunnable.java   
public static void main(String[] args)
   {

StringBuilder s = new StringBuilder("Hahaha");

// Notice: void run method are the same to both, but I overloaded it.
Thread t = new Thread(new threadAndRunnable(s)); // this calls void run method 
t.start();                                       // by the Interface Runnable

(new threadAndRunnable()).start(); // this calls a Thread by class Thread()

for(int i=0; i < 10; i++) // And it, only repetely shows a message 
       {
    System.out.println("tchau!");
    try{Thread.sleep(90);}catch(InterruptedException e){} 
       }

   }
项目:java-koofr    文件:Main.java   
private void cd() throws IOException, JsonException {
    String dirname = sc.nextLine().trim().toLowerCase(); //for doing case-insensitive comparison
    if (dirname.equals("..")) {
        String[] parts = this.path.split("/");
        StringBuilder sb = new StringBuilder("/");
        for(int i = 1, up = parts.length-1; i < up; i++) {
            sb.append(parts[i]);
            sb.append("/");
        }
        this.path = sb.toString();
        return;
    }

    Files files = api.mounts().mount(this.mountId).files().list(this.path);
    for(File f : files.files) {
        if (f.type.equals("dir") && f.name.toLowerCase().equals(dirname)) {
            this.path = (this.path + "/" + f.name).replaceAll("/+", "/");
            return;
        }
    }
    System.out.println("No such directory");
}
项目:Paguro    文件:TupleGenerator.java   
static String tupleTestParamsReplace(int i, Function<Integer,String> repFun) {
    StringBuilder sB = new StringBuilder();
    boolean isFirst = true;
    for (int j = 1; j <= i; j++) {
        if (isFirst) {
            isFirst = false;
        } else {
            sB.append(",");
        }
        String repStr = repFun.apply(j);
        if (repStr == null) {
            sB.append("\"" + ordinal(j) + "\"");
        } else {
            sB.append(repStr);
        }
    }
    return sB.toString();
}
项目:Chronicle-Map    文件:ReplicatedGlobalMutableState$$Native.java   
@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("ReplicatedGlobalMutableState");
    sb.append(", allocatedExtraTierBulks=").append(getAllocatedExtraTierBulks());
    sb.append(", firstFreeTierIndex=").append(getFirstFreeTierIndex());
    sb.append(", extraTiersInUse=").append(getExtraTiersInUse());
    sb.append(", segmentHeadersOffset=").append(getSegmentHeadersOffset());
    sb.append(", dataStoreSize=").append(getDataStoreSize());
    sb.append(", currentCleanupSegmentIndex=").append(getCurrentCleanupSegmentIndex());
    sb.append(", modificationIteratorsCount=").append(getModificationIteratorsCount());
    sb.append(", modificationIteratorInit=[");
    for (int index = 0; index < 128; index++) {
        sb.append(getModificationIteratorInitAt(index)).append(',').append(' ');
    }
    sb.setCharAt(sb.length() - 2, ']');
    sb.setLength(sb.length() - 1);
    sb.setCharAt(28, '{');
    sb.append(' ').append('}');
    return sb.toString();
}
项目:vis-editor    文件:VisTextField.java   
void paste (String content, boolean fireChangeEvent) {
    if (content == null) return;
    StringBuilder buffer = new StringBuilder();
    int textLength = text.length();
    if (hasSelection) textLength -= Math.abs(cursor - selectionStart);
    BitmapFontData data = style.font.getData();
    for (int i = 0, n = content.length(); i < n; i++) {
        if (!withinMaxLength(textLength + buffer.length())) break;
        char c = content.charAt(i);
        if (!(writeEnters && (c == ENTER_ANDROID || c == ENTER_DESKTOP))) {
            if (c == '\r' || c == '\n') continue;
            if (onlyFontChars && !data.hasGlyph(c)) continue;
            if (filter != null && !filter.acceptChar(this, c)) continue;
        }
        buffer.append(c);
    }
    content = buffer.toString();

    if (hasSelection) cursor = delete(fireChangeEvent);
    if (fireChangeEvent)
        changeText(text, insert(cursor, content, text));
    else
        text = insert(cursor, content, text);
    updateDisplayText();
    cursor += content.length();
}
项目:vis-editor    文件:FileChooser.java   
private void updateSelectedFileFieldText (boolean ignoreKeyboardFocus) {
    if (ignoreKeyboardFocus == false && getChooserStage() != null) {
        if (getChooserStage().getKeyboardFocus() == selectedFileTextField) return;
    }
    if (selectedItems.size == 0) {
        selectedFileTextField.setText("");
    } else if (selectedItems.size == 1) {
        selectedFileTextField.setText(selectedItems.get(0).getFile().name());
    } else {
        StringBuilder builder = new StringBuilder();

        for (FileItem item : selectedItems) {
            builder.append('"');
            builder.append(item.file.name());
            builder.append("\" ");
        }

        selectedFileTextField.setText(builder.toString());
    }
    selectedFileTextField.setCursorAtTextEnd();
}
项目:OOP    文件:Ex07InsertAndRemove.java   
public static String getStringsUntil(String delimiter){

    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String temp;

    while (true){

        temp = sc.nextLine();
        if (temp.equals(delimiter)){
            break;
        }
        sb.append(temp);
        sb.append("\n");
    }

    return sb.toString();
}
项目:servicemix    文件:Person.java   
public String getName() {
    StringBuilder name = new StringBuilder();

    // Age
    if (getAge()>=21){
        name.append("old");
    }else{
        name.append("young");
    }

    //Income
    if (isRich()){
        name.append(" rich");
    }

    //Sex
    if (getSex() == Sex.MALE){
        name.append(" man");
    }else{
         name.append(" woman");
    }

    return name.toString();
}
项目:glowing-spice    文件:MovieList.java   
/**
 * Retrns a json encoded string of the object passed
 *
 * @param MovieList movieList
 * @return String json
 */
public static String toJSON(MovieList movieList)
{
    StringBuilder json = new StringBuilder();
    json.append("{");
    json.append("\"movies\":");
    json.append("[");
    ArrayList<Movie> movies = movieList.getMovies();
    for(int i = 0; i < movies.size(); i++)
    {
        json.append(movies.get(i).toJSON());
        if(i + 1 < movies.size())
        {
            json.append(",");
        }
    }
    json.append("]}");
    return json.toString();
}
项目:glowing-spice    文件:NowPlaying.java   
public String toJSON()
{
    StringBuilder json = new StringBuilder();
    json.append("{");
    if(this.playerIsOpen)
    {
        json.append("\"isPlaying\":\"").append(this.player.isPlaying()).append("\",");
        json.append("\"isPaused\":\"").append(this.player.isPaused()).append("\",");
        json.append("\"movie\":\"").append(this.player.getPlayingFile().getName()).append("\"");
    } 
    else {
        json.append("\"isPlaying\":\"").append(false).append("\",");
        json.append("\"isPaused\":\"").append(false).append("\",");
        json.append("\"movie\":\"").append(false).append("\"");
    }
    json.append("}");

    return json.toString();
}
项目:knapsack-problem-ga-java    文件:KnapsackProblem.java   
/**  
 * Generates a single gene, a random String of 1s and 0s
 * @return String - a randomly generated gene
 */
private String makeGene() {

    // Stringbuilder builds gene, one chromosome (1 or 0) at a time
    StringBuilder gene = new StringBuilder(number_of_items);

    // Each chromosome
    char c;

    // Loop creating gene
    for(int i = 0; i < number_of_items; i++) {
        c = '0';
        double rnd = Math.random(); 
        // If random number is greater than 0.5, chromosome is '1'
        // If random number is less than 0.5, chromosome is '0'
        if(rnd > 0.5) {
            c = '1';
        }
        // Append chromosome to gene
        gene.append(c);
    }
    // Stringbuilder object to string; return
    return gene.toString();
}
项目:Rhombus    文件:StringUtil.java   
public static String detailedMapToString(Map map) {
    StringBuilder sb = new StringBuilder();
    sb.append("{\n");
    for(Object key : map.keySet()) {
        sb.append("\t");
        sb.append(String.valueOf(key));
        sb.append(": (");
        Object value = map.get(key);
        sb.append((value==null)? "NULL":value.getClass().getName());
        sb.append(") ");
        sb.append((value==null)? "NULL":String.valueOf(value));
        sb.append("\n");
    }
    sb.append("}");
    return sb.toString();
}
项目:melody-join    文件:CrawlReducer.java   
private String getFeature(String url) throws ClientProtocolException, IOException, DecoderException {
    StringBuilder valBuilder = new StringBuilder();
    HttpGet httpget = new HttpGet(url);
    httpget.setConfig(reqConf);
    response = httpClient.execute(httpget);
    HttpEntity entity = response.getEntity();
    if (entity == null) {
        throw new ClientProtocolException("Response contains no content");
    }
    ContentType contentType = ContentType.get(entity);
    if (contentType != null && StringUtils.equalsIgnoreCase(contentType.getMimeType(), MIME_JPG)) {
        image = ImageIO.read(entity.getContent());
        if (image == null) {
            System.out.println(url + " cannot be found");
        }
        for (String featureName : builders.keySet()) {
            DocumentBuilder builder = builders.get(featureName);
            featureOutput = GenerateUtil.processImage(image, "",imageGrid, builder, featureName, featureOutput, lireFeatures, featureUsed);
            valBuilder.append(" " + ConfUtils.SEPARATOR + " " + featureName + " ");
            valBuilder.append(FormatUtil.toTextString(featureOutput));
        }           
    }
    return valBuilder.toString();
}
项目:Jogre    文件:JumpingCoreModel.java   
/**
 * This routine will create the code string for the current track
 * configuration.
 */
public String createCodeForTrack() {
    StringBuilder sb = new StringBuilder();

    int dist = 0;
    for (int s=1; s < TRACK_SPACES; s++) {
        JumpingFence fence = getFenceAt(s);
        if (fence == null) {
            dist += 1;
            if (dist == 5) {
                sb.append('z');
                dist = 0;
            }
        } else {
            if (fence.isWaterJump()) {
                sb.append((char) ('1' + dist) );
                s += 3;
            } else {
                sb.append((char) ('a' + dist + ((fence.type()-1) * 5)));
            }
            dist = 0;
        }
    }

    return sb.toString();
}
项目:wire    文件:SimpleMessage.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (optional_int32 != null) builder.append(", optional_int32=").append(optional_int32);
  if (optional_nested_msg != null) builder.append(", optional_nested_msg=").append(optional_nested_msg);
  if (optional_external_msg != null) builder.append(", optional_external_msg=").append(optional_external_msg);
  if (default_nested_enum != null) builder.append(", default_nested_enum=").append(default_nested_enum);
  builder.append(", required_int32=").append(required_int32);
  if (!repeated_double.isEmpty()) builder.append(", repeated_double=").append(repeated_double);
  if (default_foreign_enum != null) builder.append(", default_foreign_enum=").append(default_foreign_enum);
  if (no_default_foreign_enum != null) builder.append(", no_default_foreign_enum=").append(no_default_foreign_enum);
  if (package_ != null) builder.append(", package=").append(package_);
  if (result != null) builder.append(", result=").append(result);
  if (other != null) builder.append(", other=").append(other);
  if (o != null) builder.append(", o=").append(o);
  return builder.replace(0, 2, "SimpleMessage{").append('}').toString();
}
项目:wire    文件:MessageOptions.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (message_set_wire_format != null) builder.append(", message_set_wire_format=").append(message_set_wire_format);
  if (no_standard_descriptor_accessor != null) builder.append(", no_standard_descriptor_accessor=").append(no_standard_descriptor_accessor);
  if (deprecated != null) builder.append(", deprecated=").append(deprecated);
  if (map_entry != null) builder.append(", map_entry=").append(map_entry);
  if (!uninterpreted_option.isEmpty()) builder.append(", uninterpreted_option=").append(uninterpreted_option);
  if (my_message_option_one != null) builder.append(", my_message_option_one=").append(my_message_option_one);
  if (my_message_option_two != null) builder.append(", my_message_option_two=").append(my_message_option_two);
  if (my_message_option_three != null) builder.append(", my_message_option_three=").append(my_message_option_three);
  if (my_message_option_four != null) builder.append(", my_message_option_four=").append(my_message_option_four);
  if (my_message_option_five != null) builder.append(", my_message_option_five=").append(my_message_option_five);
  if (my_message_option_six != null) builder.append(", my_message_option_six=").append(my_message_option_six);
  if (foreign_message_option != null) builder.append(", foreign_message_option=").append(foreign_message_option);
  return builder.replace(0, 2, "MessageOptions{").append('}').toString();
}
项目:wire    文件:FileOptions.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (java_package != null) builder.append(", java_package=").append(java_package);
  if (java_outer_classname != null) builder.append(", java_outer_classname=").append(java_outer_classname);
  if (java_multiple_files != null) builder.append(", java_multiple_files=").append(java_multiple_files);
  if (java_generate_equals_and_hash != null) builder.append(", java_generate_equals_and_hash=").append(java_generate_equals_and_hash);
  if (java_string_check_utf8 != null) builder.append(", java_string_check_utf8=").append(java_string_check_utf8);
  if (optimize_for != null) builder.append(", optimize_for=").append(optimize_for);
  if (go_package != null) builder.append(", go_package=").append(go_package);
  if (cc_generic_services != null) builder.append(", cc_generic_services=").append(cc_generic_services);
  if (java_generic_services != null) builder.append(", java_generic_services=").append(java_generic_services);
  if (py_generic_services != null) builder.append(", py_generic_services=").append(py_generic_services);
  if (deprecated != null) builder.append(", deprecated=").append(deprecated);
  if (cc_enable_arenas != null) builder.append(", cc_enable_arenas=").append(cc_enable_arenas);
  if (objc_class_prefix != null) builder.append(", objc_class_prefix=").append(objc_class_prefix);
  if (csharp_namespace != null) builder.append(", csharp_namespace=").append(csharp_namespace);
  if (!uninterpreted_option.isEmpty()) builder.append(", uninterpreted_option=").append(uninterpreted_option);
  return builder.replace(0, 2, "FileOptions{").append('}').toString();
}
项目:proctor-demo    文件:Browser.java   
@Nullable
public static String getIOSVersion(@Nullable final String ua) {
    if (ua == null) return null;
    StringBuilder versionBuilder = new StringBuilder(6);
    int index = ua.indexOf("OS ");
    if (index == -1) return null;
    index += 3; // skip over "OS ".
    if (!Character.isDigit(ua.charAt(index))) {
        return null;
    }
    while (index < ua.length() && ua.charAt(index) != ' ') {
        versionBuilder.append(ua.charAt(index));
        index++;
    }
    return versionBuilder.toString().replace('_', '.');
}
项目:wire    文件:FileDescriptorProto.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (name != null) builder.append(", name=").append(name);
  if (package_ != null) builder.append(", package=").append(package_);
  if (!dependency.isEmpty()) builder.append(", dependency=").append(dependency);
  if (!public_dependency.isEmpty()) builder.append(", public_dependency=").append(public_dependency);
  if (!weak_dependency.isEmpty()) builder.append(", weak_dependency=").append(weak_dependency);
  if (!message_type.isEmpty()) builder.append(", message_type=").append(message_type);
  if (!enum_type.isEmpty()) builder.append(", enum_type=").append(enum_type);
  if (!service.isEmpty()) builder.append(", service=").append(service);
  if (!extension.isEmpty()) builder.append(", extension=").append(extension);
  if (options != null) builder.append(", options=").append(options);
  if (source_code_info != null) builder.append(", source_code_info=").append(source_code_info);
  if (syntax != null) builder.append(", syntax=").append(syntax);
  return builder.replace(0, 2, "FileDescriptorProto{").append('}').toString();
}
项目:Jogre    文件:TriangulumModel.java   
private String createLastMoveString () {
    StringBuilder sb = new StringBuilder ();

    for (int i=0; i<lastMove.length; i++) {
        if (lastMove[i] == null) {
            sb.append("-1 -1 ");
        } else {
            sb.append(lastMove[i].x);
            sb.append(" ");
            sb.append(lastMove[i].y);
            sb.append(" ");
        }
    }

    return sb.toString();
}
项目:CodeU-ProjectGroup6    文件:Uuid.java   
private static void buildString(Uuid current, StringBuilder build) {
  final long mask = (1L << 32) - 1;  // removes sign extension
  if (current != null) {
    buildString(current.root(), build);
    build.append(".").append(current.id() & mask);
  }
}
项目:SVGAPlayer-Android    文件:FrameEntity.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (alpha != null) builder.append(", alpha=").append(alpha);
  if (layout != null) builder.append(", layout=").append(layout);
  if (transform != null) builder.append(", transform=").append(transform);
  if (clipPath != null) builder.append(", clipPath=").append(clipPath);
  if (!shapes.isEmpty()) builder.append(", shapes=").append(shapes);
  return builder.replace(0, 2, "FrameEntity{").append('}').toString();
}
项目:SVGAPlayer-Android    文件:MovieParams.java   
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  if (viewBoxWidth != null) builder.append(", viewBoxWidth=").append(viewBoxWidth);
  if (viewBoxHeight != null) builder.append(", viewBoxHeight=").append(viewBoxHeight);
  if (fps != null) builder.append(", fps=").append(fps);
  if (frames != null) builder.append(", frames=").append(frames);
  return builder.replace(0, 2, "MovieParams{").append('}').toString();
}