Java Code Examples for java.io.PrintStream#print()

The following examples show how to use java.io.PrintStream#print() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwitchStatement.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Print
 */
public void print(PrintStream out, int indent) {
    super.print(out, indent);
    out.print("switch (");
    expr.print(out);
    out.print(") {\n");
    for (int i = 0 ; i < args.length ; i++) {
        if (args[i] != null) {
            printIndent(out, indent + 1);
            args[i].print(out, indent + 1);
            out.print("\n");
        }
    }
    printIndent(out, indent);
    out.print("}");
}
 
Example 2
Source File: CommandGenerator.java    From com.zsmartsystems.zigbee with Eclipse Public License 1.0 6 votes vote down vote up
private void createParameterDefinition(PrintStream out, String indent, Parameter parameter) {
    if (parameter.multiple | parameter.bitfield) {
        addImport("java.util.List");
        addImport("java.util.ArrayList");
        out.println(indent + "private List<" + getTypeClass(parameter.data_type) + "> "
                + stringToLowerCamelCase(parameter.name) + " = new ArrayList<" + getTypeClass(parameter.data_type)
                + ">();");
    } else {
        out.print(indent + "private " + getTypeClass(parameter.data_type) + " "
                + stringToLowerCamelCase(parameter.name));
        if (parameter.defaultValue != null && parameter.defaultValue.length() != 0) {
            out.print(" = " + parameter.defaultValue);
        }
        out.println(";");
    }
}
 
Example 3
Source File: DeclarationStatement.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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(";");
}
 
Example 4
Source File: TestNewTextReader.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Test
public void testBomUtf8() throws Exception {
  // Simple .csv file with a UTF-8 BOM. Should read successfully
  File testFolder = tempDir.newFolder("testUtf8Folder");
  File testFile = new File(testFolder, "utf8.csv");
  PrintStream p = new PrintStream(testFile);
  p.write(ByteOrderMark.UTF_8.getBytes(), 0, ByteOrderMark.UTF_8.length());
  p.print("A,B\n");
  p.print("5,7\n");
  p.close();

  testBuilder()
    .sqlQuery(String.format("select * from table(dfs.\"%s\" (type => 'text', " +
      "fieldDelimiter => ',', lineDelimiter => '\n', extractHeader => true))",
      testFile.getAbsolutePath()))
    .unOrdered()
    .baselineColumns("A","B")
    .baselineValues("5", "7")
    .go();
}
 
Example 5
Source File: SSTableExport.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
private static void serializeRow(DeletionInfo deletionInfo, Iterator<OnDiskAtom> atoms, CFMetaData metadata, DecoratedKey key, PrintStream out)
{
    out.print("{");
    writeKey(out, "key");
    writeJSON(out, metadata.getKeyValidator().getString(key.getKey()));
    out.print(",\n");

    if (!deletionInfo.isLive())
    {
        out.print(" ");
        writeKey(out, "metadata");
        out.print("{");
        writeKey(out, "deletionInfo");
        writeJSON(out, deletionInfo.getTopLevelDeletion());
        out.print("}");
        out.print(",\n");
    }

    out.print(" ");
    writeKey(out, "cells");
    out.print("[");
    while (atoms.hasNext())
    {
        writeJSON(out, serializeAtom(atoms.next(), metadata));

        if (atoms.hasNext())
            out.print(",\n           ");
    }
    out.print("]");

    out.print("}");
}
 
Example 6
Source File: ArrayAccessExpression.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print
 */
public void print(PrintStream out) {
    out.print("(" + opNames[op] + " ");
    right.print(out);
    out.print(" ");
    if (index != null) {
        index.print(out);
    } else {
    out.print("<empty>");
    }
    out.print(")");
}
 
Example 7
Source File: Debug.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void println(PrintStream s, String name, byte[] data) {
    s.print(name + ":  { ");
    if (data == null) {
        s.print("null");
    } else {
        for (int i = 0; i < data.length; i++) {
            if (i != 0) s.print(", ");
            s.print(data[i] & 0x0ff);
        }
    }
    s.println(" }");
}
 
Example 8
Source File: XMLSerializer.java    From vxquery with Apache License 2.0 5 votes vote down vote up
private void printInteger(PrintStream ps, TaggedValuePointable tvp) {
    LongPointable lp = pp.takeOne(LongPointable.class);
    try {
        tvp.getValue(lp);
        ps.print(lp.longValue());
    } finally {
        pp.giveBack(lp);
    }
}
 
Example 9
Source File: MachSafePointNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void dumpSpec(PrintStream out) {
  try {
    JVMState jvms = jvms();
    if (jvms != null) out.print(" !");
    if (jvms == null) out.print("empty jvms");
    while (jvms != null) {
      Method m = jvms.method().method();
      int bci = jvms.bci();
      out.print(" " + m.getMethodHolder().getName().asString().replace('/', '.') + "::" + m.getName().asString() + " @ bci:" + bci);
      jvms = jvms.caller();
    }
  } catch (Exception e) {
    out.print(e);
  }
}
 
Example 10
Source File: BreakStatement.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print
 */
public void print(PrintStream out, int indent) {
    super.print(out, indent);
    out.print("break");
    if (lbl != null) {
        out.print(" " + lbl);
    }
    out.print(";");
}
 
Example 11
Source File: ConstantPositionURLWriter.java    From BUbiNG with Apache License 2.0 5 votes vote down vote up
@Override
public void write(final WarcRecord warcRecord, final long storePosition, final PrintStream out) throws IOException {
	out.print(constant);
	out.print('\t');
	out.print(storePosition);
	out.write('\t');
	out.print(warcRecord.getWarcTargetURI());
	out.write('\n');
}
 
Example 12
Source File: BandStructure.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void printArrayTo(PrintStream ps, int[] values, int start, int end) {
    int len = end-start;
    for (int i = 0; i < len; i++) {
        if (i % 10 == 0)
            ps.println();
        else
            ps.print(" ");
        ps.print(values[start+i]);
    }
    ps.println();
}
 
Example 13
Source File: FbxDump.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected static void dumpElement(FbxElement el, PrintStream ps, 
                                         int indent, Map<FbxId, FbxElement> uidToObjectMap) {
        // 4 spaces per tab should be OK.
        String indentStr = indent(indent * 4);
        String textId = el.id;
        
        // Properties are called 'P' and connections are called 'C'.
//        if (el.id.equals("P")) {
//            textId = "Property";
//        } else if (el.id.equals("C")) {
//            textId = "Connect";
//        }
        
        ps.print(indentStr + textId + ": ");
        for (int i = 0; i < el.properties.size(); i++) {
            Object property = el.properties.get(i);
            char propertyType = el.propertiesTypes[i];
            dumpProperty(el.id, propertyType, property, ps, uidToObjectMap);
            if (i != el.properties.size() - 1) {
                ps.print(", ");
            }
        }
        if (el.children.isEmpty()) {
            ps.println();
        } else {
            ps.println(" {");
            for (FbxElement childElement : el.children) {
                dumpElement(childElement, ps, indent + 1, uidToObjectMap);
            }
            ps.println(indentStr + "}");
        }
    }
 
Example 14
Source File: Block.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void dump(PrintStream out) {
  out.print("B" + preOrder());
  out.print(" Freq: " + freq());
  out.println();
  Node_List nl = nodes();
  int cnt = nl.size();
  for( int i=0; i<cnt; i++ )
    nl.at(i).dump(out);
  out.print("\n");
}
 
Example 15
Source File: Matrix.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void serialize(PrintStream outputStream) {
    outputStream.print("[");
    for(int i=0;i< Math.min(this.m,40);i++){
       if(i>0) outputStream.print(";");
       for(int j=0;j<Math.min(this.n,40);j++){
          if(j>0) {
              outputStream.print(",");
          }
          outputStream.print(this.values[i][j]);
       }
    }
    outputStream.print("]");
}
 
Example 16
Source File: Histogram.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void dump(PrintStream stream) {
  stream.print("dumping Histogram " + name + ":\n");

  Iterator<Map.Entry<Long, Long>> iter = iterator();

  while (iter.hasNext()) {
    Map.Entry<Long, Long> ent = iter.next();

    stream.print("val/count pair: " + (long) ent.getKey() + ", "
        + (long) ent.getValue() + "\n");
  }

  stream.print("*** end *** \n");
}
 
Example 17
Source File: DoubleExpression.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Print
 */
public void print(PrintStream out) {
    out.print(value + "D");
}
 
Example 18
Source File: FlowRefSymbol.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public void print(PrintStream s, ParserWalker pos) {
	long val = pos.getFlowRefAddr().getOffset();
	s.append("0x");
	s.print(Long.toHexString(val));
}
 
Example 19
Source File: Statement.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void print(PrintStream out, int indent) {
    if (labels != null) {
        for (int i = labels.length; --i >= 0; )
            out.print(labels[i] + ": ");
    }
}
 
Example 20
Source File: AbstractResource.java    From webarchive-commons with Apache License 2.0 3 votes vote down vote up
public static void dumpShort(PrintStream out, Resource resource) throws IOException {

		MetaData m = resource.getMetaData();

//		out.println("Headers Before");
//		out.print(m.toString());
		
		long bytes = StreamCopy.copy(resource.getInputStream(), ByteStreams.nullOutputStream());
		out.println("Resource Was:"+bytes+" Long");

		out.println("[\n]Headers After");
		out.print(m.toString());

	}