当前位置: 首页>>代码示例>>Java>>正文


Java Formatter.close方法代码示例

本文整理汇总了Java中java.util.Formatter.close方法的典型用法代码示例。如果您正苦于以下问题:Java Formatter.close方法的具体用法?Java Formatter.close怎么用?Java Formatter.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Formatter的用法示例。


在下文中一共展示了Formatter.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

import java.util.Formatter; //导入方法依赖的package包/类
public static String toString(BarcodeValue[][] barcodeMatrix) {
    Formatter formatter = new Formatter();
    for (int row = 0; row < barcodeMatrix.length; row++) {
        formatter.format("Row %2d: ", new Object[]{Integer.valueOf(row)});
        for (BarcodeValue barcodeValue : barcodeMatrix[row]) {
            if (barcodeValue.getValue().length == 0) {
                formatter.format("        ", (Object[]) null);
            } else {
                formatter.format("%4d(%2d)", new Object[]{Integer.valueOf
                        (barcodeMatrix[row][column].getValue()[0]),
                        barcodeMatrix[row][column].getConfidence(barcodeMatrix[row][column]
                                .getValue()[0])});
            }
        }
        formatter.format("%n", new Object[0]);
    }
    String result = formatter.toString();
    formatter.close();
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:PDF417ScanningDecoder.java

示例2: toFormattedString

import java.util.Formatter; //导入方法依赖的package包/类
/***
 * Returns a string representation of the FTPFile information.
 * This currently mimics the Unix listing format.
 *
 * @return A string representation of the FTPFile information.
 * @since 3.0
 */
public String toFormattedString()
{
    StringBuilder sb = new StringBuilder();
    Formatter fmt = new Formatter(sb);
    sb.append(formatType());
    sb.append(permissionToString(USER_ACCESS));
    sb.append(permissionToString(GROUP_ACCESS));
    sb.append(permissionToString(WORLD_ACCESS));
    fmt.format(" %4d", Integer.valueOf(getHardLinkCount()));
    fmt.format(" %-8s %-8s", getGroup(), getUser());
    fmt.format(" %8d", Long.valueOf(getSize()));
    Calendar timestamp = getTimestamp();
    if (timestamp != null) {
        fmt.format(" %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", timestamp);
        fmt.format(" %1$tZ", timestamp);
        sb.append(' ');
    }
    sb.append(' ');
    sb.append(getName());
    fmt.close();
    return sb.toString();
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:30,代码来源:FTPFile.java

示例3: buildSensorControlCommand

import java.util.Formatter; //导入方法依赖的package包/类
/**
 * build TDV string of the sensor control command
 * @param info     sensor info
 * @param value    command value
 * @return TDV command string
 */
public static String buildSensorControlCommand(SensorInfo info, int value) {
    Formatter formatter = new Formatter();
    formatter.format("%02x", info.getType().getValueTDVTypes()[0]);
    switch (info.getType()) {
        case BUZZER:
            formatter.format("%02x", ValueType.UCHAR.getCode());
            formatter.format("%02x", value);
            break;
        case LED:
            formatter.format("%02x", ValueType.CHAR3.getCode());
            formatter.format("%06x", value);
            break;
        default:
            formatter.format("%02x", ValueType.BOOL.getCode());
            formatter.format("%02x", value);
            break;
    }
    String result = formatter.toString();
    formatter.close();
    return result;
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:28,代码来源:TDVBuilder.java

示例4: listArray

import java.util.Formatter; //导入方法依赖的package包/类
/**
 * Generates a string holding the named definition
 * of a 2D double array for Mathematica in the form
 * name = {{A[0][0],...,A[0][m-1]},
 * {A[1][0],...,A[1][m-1]}, ...,
 * {A[n-1][0], A[n-1][1], ...,A[n-1][m-1]}};
 * @param name the identifier to be used in Mathematica.
 * @param A the array to be encoded (of length m).
 * @return a String holding the Mathematica definition.
 */
public static String listArray(String name, double[][] A) {
	StringBuilder sb = new StringBuilder();
	Formatter formatter = new Formatter(sb, Locale.US);
	String fs = PrintPrecision.getFormatStringFloat();
	formatter.format(name + " = {");
	for (int i = 0; i < A.length; i++) {
		if (i == 0)
			formatter.format("{");
		else
			formatter.format(", \n{");
		for (int j = 0; j < A[i].length; j++) {
			if (j == 0) 
				formatter.format(fs, A[i][j]);
			else
				formatter.format(", " + fs, A[i][j]);
		}
		formatter.format("}");
	}
	formatter.format("};\n");
	String result = formatter.toString();
	formatter.close();
	return result;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:34,代码来源:MathematicaIO.java

示例5: toString

import java.util.Formatter; //导入方法依赖的package包/类
public static String toString(BarcodeValue[][] barcodeMatrix) {
  Formatter formatter = new Formatter();
  for (int row = 0; row < barcodeMatrix.length; row++) {
    formatter.format("Row %2d: ", row);
    for (int column = 0; column < barcodeMatrix[row].length; column++) {
      BarcodeValue barcodeValue = barcodeMatrix[row][column];
      if (barcodeValue.getValue().length == 0) {
        formatter.format("        ", (Object[]) null);
      } else {
        formatter.format("%4d(%2d)", barcodeValue.getValue()[0],
            barcodeValue.getConfidence(barcodeValue.getValue()[0]));
      }
    }
    formatter.format("%n");
  }
  String result = formatter.toString();
  formatter.close();
  return result;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:PDF417ScanningDecoder.java

示例6: stringForTimeNoHour

import java.util.Formatter; //导入方法依赖的package包/类
public static String stringForTimeNoHour(long timeMs) {
    String formatter;
    StringBuilder formatBuilder = new StringBuilder();
    Formatter formatter2 = new Formatter(formatBuilder, Locale.getDefault());
    if (timeMs >= 0) {
        try {
            int totalSeconds = (int) (timeMs / 1000);
            int seconds = totalSeconds % 60;
            int minutes = totalSeconds / 60;
            formatBuilder.setLength(0);
            formatter = formatter2.format("%02d:%02d", new Object[]{Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString();
        } finally {
            formatter2.close();
        }
    } else {
        formatter = "00:00";
        formatter2.close();
    }
    return formatter;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:EpisodeUtils.java

示例7: stringForTime

import java.util.Formatter; //导入方法依赖的package包/类
public static String stringForTime(long timeMs) {
    StringBuilder formatBuilder = new StringBuilder();
    Formatter formatter = new Formatter(formatBuilder, Locale.getDefault());
    try {
        String formatter2;
        int totalSeconds = (int) (timeMs / 1000);
        int seconds = totalSeconds % 60;
        int minutes = (totalSeconds / 60) % 60;
        int hours = totalSeconds / 3600;
        formatBuilder.setLength(0);
        if (hours > 0) {
            formatter2 = formatter.format("%02d:%02d:%02d", new Object[]{Integer.valueOf(hours), Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString();
        } else {
            formatter2 = formatter.format("%02d:%02d", new Object[]{Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString();
            formatter.close();
        }
        return formatter2;
    } finally {
        formatter.close();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:EpisodeUtils.java

示例8: getNumberTime2

import java.util.Formatter; //导入方法依赖的package包/类
public static String getNumberTime2(long time_second) {
    Formatter formatter = new Formatter(null, Locale.getDefault());
    if (time_second < 0) {
        time_second = 0;
    }
    try {
        String formatter2;
        long seconds = time_second % 60;
        if (time_second / 60 > 99) {
            formatter2 = formatter.format("%03d:%02d", new Object[]{Long.valueOf(time_second / 60), Long.valueOf(seconds)}).toString();
        } else {
            formatter2 = formatter.format("%02d:%02d", new Object[]{Long.valueOf(time_second / 60), Long.valueOf(seconds)}).toString();
            formatter.close();
        }
        return formatter2;
    } finally {
        formatter.close();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:20,代码来源:LetvUtils.java

示例9: toString

import java.util.Formatter; //导入方法依赖的package包/类
public String toString() {
	Formatter fm = new Formatter(new StringBuilder(), Locale.US);
	fm.format("Region %d", label);
	fm.format(", area = %d", size);
	fm.format(", bounding box = (%d, %d, %d, %d)", left, top, right, bottom );
	fm.format(", centroid = (%.2f, %.2f)", xc, yc);
	if (innerContours != null)
		fm.format(", holes = %d", innerContours.size());
	String s = fm.toString();
	fm.close();
	return s;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:13,代码来源:RegionLabeling.java

示例10: byteToHex

import java.util.Formatter; //导入方法依赖的package包/类
private static String byteToHex(final byte[] hash) {
	Formatter formatter = new Formatter();
	for (byte b : hash) {
		formatter.format("%02x", b);
	}
	String result = formatter.toString();
	formatter.close();
	return result;
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:10,代码来源:WeiXinSignUtils.java

示例11: byteArray2Hex

import java.util.Formatter; //导入方法依赖的package包/类
private static String byteArray2Hex(final byte[] hash) {
    Formatter formatter = new Formatter();
    try {
        for (byte b : hash) {
            formatter.format("%02x", b);
        }
        return formatter.toString();
    } finally {
        formatter.close();
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:JarListSanitizer.java

示例12: toString

import java.util.Formatter; //导入方法依赖的package包/类
public String toString() {
    Formatter formatter = new Formatter();
    Codeword[] codewordArr = this.codewords;
    int length = codewordArr.length;
    int i = 0;
    int row = 0;
    while (i < length) {
        int row2;
        Codeword codeword = codewordArr[i];
        Object[] objArr;
        if (codeword == null) {
            objArr = new Object[1];
            row2 = row + 1;
            objArr[0] = Integer.valueOf(row);
            formatter.format("%3d:    |   %n", objArr);
        } else {
            objArr = new Object[3];
            row2 = row + 1;
            objArr[0] = Integer.valueOf(row);
            objArr[1] = Integer.valueOf(codeword.getRowNumber());
            objArr[2] = Integer.valueOf(codeword.getValue());
            formatter.format("%3d: %3d|%3d%n", objArr);
        }
        i++;
        row = row2;
    }
    String result = formatter.toString();
    formatter.close();
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:DetectionResultColumn.java

示例13: print

import java.util.Formatter; //导入方法依赖的package包/类
void print(float[] arr) {
	int linelength = 16;
	StringBuilder sb = new StringBuilder();
	Formatter fm = new Formatter(sb, Locale.US);
	for (int i = 0; i < arr.length; i++) {
		if (i > 0 && i % linelength == 0) {
			IJ.log(sb.toString());
			sb.setLength(0);
		}
		fm.format(" %.2f", arr[i]);
	}
	IJ.log(sb.toString());
	fm.close();
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:15,代码来源:SiftDetector.java

示例14: doStepInternal

import java.util.Formatter; //导入方法依赖的package包/类
protected void doStepInternal() {
    try {
       
        Formatter formatter = new Formatter("energy-"+fileTail);
        Vector pos = adatom.getPosition();
        // Move atom along Y-axis, steps by 0.1
        for(int i=0; i<292; i++){ //292
            
            // Return atom to original Z position
            adatom.getPosition().setX(2, -1.6);
            
            // Move atom along Z-axis, steps by 0.1
            for(int j=0; j<213; j++){  //213
                // --PRINT-- 
                formatter.format("%f %7.2f %7.2f %7.2f \n",new Object[] {energy.getDataAsScalar(),pos.getX(0), pos.getX(1), pos.getX(2)});
                
                // Step atom by 0.1 along Z-axis
                adatom.getPosition().setX(2, adatom.getPosition().getX(2) +0.02);
            }
            // Step atom by 0.1 along Y-axis
            adatom.getPosition().setX(1, adatom.getPosition().getX(1) + 0.02);
 
        }
        formatter.close();
    }
    catch (IOException e) {
        
    }
}
 
开发者ID:etomica,项目名称:etomica,代码行数:30,代码来源:IntegratorEnergyMap.java

示例15: buildSensorControlCommand

import java.util.Formatter; //导入方法依赖的package包/类
/**
 * build TLV string of the sensor control command
 * @param info     sensor info
 * @param value    command value
 * @return TLV command string
 */
public static String buildSensorControlCommand(SensorInfo info, int value) {
    Formatter formatter = new Formatter();
    formatter.format("%02x", info.getType().getValueTLVTypes()[0]);
    formatter.format("%02x", 1);
    formatter.format("%02x", value);
    String result = formatter.toString();
    formatter.close();
    return result;
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:16,代码来源:TLVBuilder.java


注:本文中的java.util.Formatter.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。