本文整理汇总了Java中java.io.PrintStream.print方法的典型用法代码示例。如果您正苦于以下问题:Java PrintStream.print方法的具体用法?Java PrintStream.print怎么用?Java PrintStream.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintStream
的用法示例。
在下文中一共展示了PrintStream.print方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void write(final File parentDir) {
try {
final PrintStream out = open(parentDir);
out.println("package " + pkg + ";");
out.println();
out.print("public " + (isFinal() ? "final" : "") + " class " + className);
if(genericArgs != null) out.print("<" + genericArgs + ">");
if (superClass != null) out.print(" extends " + superClass);
out.println(" {");
writeBeginning(out);
writeBody(out);
writeEnd(out);
out.println("}");
close(out);
} catch (final IOException e) { throw new RuntimeException(e); }
}
示例2: loadPrescription
import java.io.PrintStream; //导入方法依赖的package包/类
public void loadPrescription(int prescriptionId) {
prescription = prescriptionGetway.getPrescription(prescriptionId);
drugs = prescriptionGetway.getSelectedPrescriptionDrugs(prescriptionId);
patient = patientGetway.selectedPatient(prescription.getPatientId());
lblPatientName.setText("Patient Name : " + prescription.getPatientName());
lblDate.setText("Prescription Date : " + prescription.getDate());
try {
file = new File("Prescription.html");
file.createNewFile();
out = new PrintStream(file);
out.print(maker.makePrescription(prescription, drugs,patient));
engine = webView.getEngine();
engine.load(file.toURI().toString());
// Desktop.getDesktop().browse(URI.create("Prescription.html"));
System.out.println(file.getAbsolutePath());
} catch (IOException ex) {
Logger.getLogger(ViewTemplateController.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例3: printFromNode
import java.io.PrintStream; //导入方法依赖的package包/类
/** Debugging */
private void printFromNode(RBNode node, PrintStream tty, int indentDepth) {
for (int i = 0; i < indentDepth; i++) {
tty.print(" ");
}
tty.print("-");
if (node == null) {
tty.println();
return;
}
tty.println(" " + node +
" (min " + ((IntervalNode) node).getMinEndpoint() +
", max " + ((IntervalNode) node).getMaxEndpoint() + ")" +
((node.getColor() == RBColor.RED) ? " (red)" : " (black)"));
if (node.getLeft() != null) printFromNode(node.getLeft(), tty, indentDepth + 2);
if (node.getRight() != null) printFromNode(node.getRight(), tty, indentDepth + 2);
}
示例4: print
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Print
*/
public void print(PrintStream out, int indent) {
super.print(out, indent);
out.print("for (");
if (init != null) {
init.print(out, indent);
out.print(" ");
} else {
out.print("; ");
}
if (cond != null) {
cond.print(out);
out.print(" ");
}
out.print("; ");
if (inc != null) {
inc.print(out);
}
out.print(") ");
if (body != null) {
body.print(out, indent);
} else {
out.print(";");
}
}
示例5: print
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Print
*/
public void print(PrintStream out, int indent) {
out.print("declare ");
super.print(out, indent);
type.print(out);
out.print(" ");
for (int i = 0 ; i < args.length ; i++) {
if (i > 0) {
out.print(", ");
}
if (args[i] != null) {
args[i].print(out);
} else {
out.print("<empty>");
}
}
out.print(";");
}
示例6: print
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Print
*/
public void print(PrintStream out, int indent) {
super.print(out, indent);
out.print("while ");
cond.print(out);
if (body != null) {
out.print(" ");
body.print(out, indent);
} else {
out.print(";");
}
}
示例7: print
import java.io.PrintStream; //导入方法依赖的package包/类
public void print(String progName, PrintStream os)
{
if (progName != null && !progName.isEmpty())
os.printf("%s: ", progName);
if (filename.equals("-"))
os.printf("<stdin>");
else
os.print(filename);
if (lineNo != -1)
{
os.printf(":%d", lineNo);
if (columnNo != -1)
os.printf(":%d", columnNo+1);
}
os.printf(": %s%n", message);
if (lineNo != -1 && columnNo != -1)
{
os.println(lineContents);
/// print out spaces/tabs before caret.
for (int i = 0; i < columnNo; i++)
os.print(lineContents.charAt(i) == '\t'?'\t':' ');
os.println("^");
}
}
示例8: printShort
import java.io.PrintStream; //导入方法依赖的package包/类
public void printShort(PrintStream stream) {
if (getMethod() == null) {
stream.println(getSpecial());
} else {
int bc = isOsr() ? getBCI() : -1;
stream.print(getId() + getMethod().decodeFlags(bc) + " " + compiler + " " + getMethod().format(bc));
}
}
示例9: printValue
import java.io.PrintStream; //导入方法依赖的package包/类
static void printValue( PrintStream ps, LuaValue v ) {
switch ( v.type() ) {
case LuaValue.TSTRING: printString( ps, (LuaString) v ); break;
default: ps.print( v.tojstring() );
}
}
示例10: printCommandHelp
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* This method prints the command help message.
*
* @param longVersion specifies true to print the long version of the message, false to print the short version.
* @param helpOut specifies standard output stream for the help message.
*/
public void printCommandHelp(boolean longVersion, PrintStream helpOut)
{
helpOut.print(
"<Options>:\n" +
"\t-(0|1|2)\t\t\t- Specifies output verbose level (0: minimum, 1: medium, 2: maximum - default is 1).\n" +
"<Model>:\n" +
"\tstatus[?team=<TeamKey>&event=<EventKey>]\n" +
"\tteams[?(year=<Year>|team=<TeamKey>|event=<EventKey>|district=<DistrictKey>)]\n" +
"\tevents?(year=<Year>|team=<TeamKey>[&year=<Year>]|event=<EventKey>|district=<DistrictKey>)\n" +
"\tdistricts?(year=<Year>|team=<TeamKey>)\n" +
"\tmatches?(team=<TeamKey>&year=<Year>|event=<EventKey>[&team=<TeamKey>]|match=<MatchKey>)\n" +
"\tawards?(team=<TeamKey>[&year=<Year>]|event=<EventKey>[&team=<TeamKey>])\n" +
"\trankings?(event=<EventKey>|district=<DistrictKey>)\n" +
"\toprs?event=<EventKey>\n" +
"\tdistrict_points?event=<EventKey>\n" +
"\tinsights?event=<EventKey>\n" +
"\tpredictions?event=<EventKey>\n" +
"\talliances?event=<EventKey>\n" +
"\tyears_participated?team=<TeamKey>\n" +
"\trobots?team=<TeamKey>\n" +
"\tmedia?team=<TeamKey>&year=<Year>\n" +
"\tsocial_media?team=<TeamKey>\n");
if (longVersion)
{
tbaApi.printApiHelp(helpOut);
}
}
示例11: write
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void write(final WarcRecord warcRecord, final long storePosition, final PrintStream out) throws IOException {
if (repeatedSet.contains(storeIndexMask | storePosition)) return;
final boolean isDuplicate = warcRecord.getWarcHeader(Name.BUBING_IS_DUPLICATE) != null;
out.print(warcRecord.getWarcTargetURI());
out.print('\t');
out.print(warcRecord.getWarcHeader(Name.WARC_PAYLOAD_DIGEST).getValue());
out.print('\t');
out.print(isDuplicate ? -1 : finalPosition++);
out.write('\t');
out.print(((HttpResponseWarcRecord)warcRecord).getStatusLine());
out.write('\n');
}
示例12: printIndent
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Writes indentation to the given stream.
*
* @param out the stream to indent
*/
private static void printIndent(final PrintStream out, final int indent) {
for (int i = 0; i < indent; i++) {
out.print(INDENT_STRING);
}
}
示例13: print
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Print
*/
public void print(PrintStream out) {
out.print(value + "L");
}
示例14: printValue
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* This method prints the value of the JSON data. If the value is a JSON object and key1 is provided, it will
* only print the values of key1 and optionally key2. If key1 is null, it will recurse into the JSON object
* and print all the nested structures.
*
* @param key specifies the key string of the JSON object, can be null if no associated key.
* @param value specifies the JSON value.
* @param level specifies the indentation level.
* @param key1 specifies the first key.
* @param key2 specifies the second key.
* @param dataOut specifies the output print stream.
*/
private void printValue(String key, JsonValue value, int level, String key1, String key2, PrintStream dataOut)
{
JsonValue.ValueType valueType = value.getValueType();
switch (valueType)
{
case OBJECT:
JsonObject obj = (JsonObject)value;
printIndentation(level, dataOut);
if (key1 != null)
{
dataOut.print(obj.get(key1));
if (key2 != null)
{
dataOut.println(": " + obj.get(key2));
}
else
{
dataOut.println();
}
}
else
{
if (key != null)
{
dataOut.print(key + ": ");
}
dataOut.println("{");
Iterator<String> iterator = obj.keySet().iterator();
while (iterator.hasNext())
{
String childKey = iterator.next();
printValue(childKey, obj.get(childKey), level + 1, key1, key2, dataOut);
}
printIndentation(level, dataOut);
dataOut.println("}");
}
break;
case ARRAY:
printIndentation(level, dataOut);
if (key != null)
{
dataOut.print(key + ": ");
}
dataOut.println("[");
JsonArray array = (JsonArray)value;
for (int i = 0; i < array.size(); i++)
{
printValue(null, array.get(i), level + 1, key1, key2, dataOut);
}
printIndentation(level, dataOut);
dataOut.println("]");
break;
default:
printIndentation(level, dataOut);
if (key != null)
{
dataOut.print(key + ": ");
}
dataOut.println(value);
break;
}
}
示例15: print
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void print(PrintStream os)
{
os.print("bit");
}