Example usage for java.io PrintStream println

List of usage examples for java.io PrintStream println

Introduction

In this page you can find the example usage for java.io PrintStream println.

Prototype

public void println() 

Source Link

Document

Terminates the current line by writing the line separator string.

Usage

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateIsBlankMethod(PrintStream aOutputStream, String aModifiers, String aMethodName,
        String aDelegateMethodPrefix, List<Parameter> aParameters, int aLinesBefore, int aLinesAfter) {
    for (int i = 0; i < aLinesBefore; i++) {
        aOutputStream.println();
    }// w  w w. j  a  va2  s .c om

    generateMethodHeader(aOutputStream, aModifiers, aMethodName, "boolean", aParameters);

    aOutputStream.println("    {");
    aOutputStream.println("        aContext.clearError();");

    generateDelegateMethodCall(aOutputStream, "boolean myBlank = " + aDelegateMethodPrefix, aParameters);

    aOutputStream.println("        checkForError( aContext );");
    aOutputStream.println("        return myBlank;");
    aOutputStream.println("    }");

    for (int i = 0; i < aLinesAfter; i++) {
        aOutputStream.println();
    }
}

From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java

private static void createMapOutputs(Iterator<OnDiskAtom> columns, PrintStream out, AbstractType<?> comparator,
        CFMetaData cfMetaData, String key) {
    while (columns.hasNext()) {
        out.print(key + " ");
        // writeJSON(out, serializeColumn(columns.next(), comparator,
        // cfMetaData));
        out.print(serializeColumn(columns.next(), comparator, cfMetaData));
        out.println();
    }/*w  w w.ja  v a 2  s.  c om*/
}

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateEncodeMethod(PrintStream aOutputStream, String aModifiers, String aDataType,
        String aMethodName, String aDelegateMethodPrefix, List<Parameter> aParameters, int aLinesBefore,
        int aLinesAfter) {
    for (int i = 0; i < aLinesBefore; i++) {
        aOutputStream.println();
    }// w  w w.  j  a va2  s . c o  m

    generateMethodHeader(aOutputStream, aModifiers, aMethodName, "void", aParameters);

    aOutputStream.println("    {");
    aOutputStream.println("        aContext.clearError();");

    generateDelegateMethodCall(aOutputStream, aDelegateMethodPrefix, aParameters);

    aOutputStream.println("        checkForError( aContext );");
    aOutputStream.println("    }");

    for (int i = 0; i < aLinesAfter; i++) {
        aOutputStream.println();
    }
}

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateDecodeMethod(PrintStream aOutputStream, String aModifiers, String aDataType,
        String aMethodName, String aDelegateMethodPrefix, List<Parameter> aParameters, int aLinesBefore,
        int aLinesAfter) {
    for (int i = 0; i < aLinesBefore; i++) {
        aOutputStream.println();
    }//from   w ww.ja  v  a 2 s  .c o  m

    generateMethodHeader(aOutputStream, aModifiers, aMethodName, aDataType, aParameters);

    aOutputStream.println("    {");
    aOutputStream.println("        aContext.clearError();");

    generateDelegateMethodCall(aOutputStream, aDataType + " myValue = " + aDelegateMethodPrefix, aParameters);

    aOutputStream.println("        checkForError( aContext );");
    aOutputStream.println("        return myValue;");
    aOutputStream.println("    }");

    for (int i = 0; i < aLinesAfter; i++) {
        aOutputStream.println();
    }
}

From source file:ca.nines.ise.cmd.Wikify.java

/**
 * Wikify a tag./* w ww.  j a  v a 2  s .c o m*/
 *
 * @param out
 * @param tag
 */
private static void wikifySchemaAttrInfo(PrintStream out, Tag tag) {
    if (tag.countAttributes() == 0) {
        return;
    }
    Formatter fmt = new Formatter(out);
    fmt.format("|| Name || Type || Optional || Empty || Renumberable || Depreciated || Options ||%n");
    for (Attribute attr : tag.getAttributes()) {
        fmt.format("|| ''%s'' || %s || %s || %s || %s || %s || %s ||%n", attr.getName(), attr.getType(),
                attr.isOptional(), attr.isEmpty(), attr.isRenumberable(), attr.getDepreciated(),
                wikifySchemaAttrOptions(attr));
        fmt.format("{{{#!td%n}}}%n{{{#!td colspan=7%n%s%n}}}%n|-------------------%n", attr.getDescription());
    }
    out.println();
}

From source file:com.zimbra.cs.mailbox.util.MetadataDump.java

public static void doDump(DbConnection conn, int mboxId, int itemId, boolean fromDumpster, PrintStream out)
        throws ServiceException {
    try {//from   w w w.  j av a  2s. co m
        int groupId = getMailboxGroup(conn, mboxId);

        boolean first = true;

        Row item = getItemRow(conn, groupId, mboxId, itemId, fromDumpster);
        List<Row> revs = getRevisionRows(conn, groupId, mboxId, itemId, fromDumpster);

        // main item
        if (!revs.isEmpty())
            printBanner(out, "Current Revision");
        item.print(out);
        first = false;

        // revisions
        for (Row rev : revs) {
            String version = rev.get("version");
            if (!first) {
                out.println();
                out.println();
            }
            printBanner(out, "Revision " + version);
            rev.print(out);
            first = false;
        }
    } catch (SQLException e) {
        throw ServiceException
                .FAILURE("error while getting metadata for item " + itemId + " in mailbox " + mboxId, e);
    }
}

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateIsConditionNameValidMethod(PrintStream aOutputStream, String aModifiers,
        String aMethodName, String aDelegateMethodPrefix, List<Parameter> aParameters, int aLinesBefore,
        int aLinesAfter) {
    List<Parameter> myParameters = new ArrayList<>(aParameters);
    myParameters.add(2, new Parameter("String", "aConditionName"));
    myParameters.add(3, new Parameter("java.util.Map<String,ConstantValue[]>", "aConditionNameValueMappings"));

    for (int i = 0; i < aLinesBefore; i++) {
        aOutputStream.println();
    }//from www . j  a  v  a  2 s .c  om

    generateMethodHeader(aOutputStream, aModifiers, aMethodName, "boolean", myParameters);

    aOutputStream.println("    {");

    generateDelegateMethodCall(aOutputStream, "return " + aDelegateMethodPrefix, myParameters);

    aOutputStream.println("    }");

    for (int i = 0; i < aLinesAfter; i++) {
        aOutputStream.println();
    }
}

From source file:com.wandrell.example.swss.client.console.ConsoleClient.java

/**
 * Runs the main application loop.// ww w. j  a v  a2 s.  co m
 * <p>
 * This is what keeps the client running and living. It can be stopped by
 * the user through a specific console command.
 *
 * @param output
 *            output where all the information will be printed
 * @param clients
 *            an {@code EntityClient} instance for each security method
 * @param uris
 *            an endpoint URI for each security method
 */
private static final void runMainLoop(final PrintStream output, final Map<Security, EntityClient> clients,
        final Map<Security, String> uris) {
    final Scanner scanner; // Scanner for reading the input
    Security security; // Selected security method
    EntityClient client; // Client for the selected security
    String uri; // Endpoint for the selected security
    String command; // Current user command

    scanner = new Scanner(System.in, "UTF-8");
    // The main loop
    // Stops when the 'exit' command is received
    do {
        // Prints options
        output.println();
        printClientOptions(output);
        output.println();

        // Reads command
        output.print("Pick an option: ");
        command = scanner.next();
        output.println();

        // Loads security from the command
        switch (command) {
        case "1":
            security = Security.UNSECURE;
            break;
        case "2":
            security = Security.PASSWORD_PLAIN_XWSS;
            break;
        case "3":
            security = Security.PASSWORD_PLAIN_WSS4J;
            break;
        case "4":
            security = Security.PASSWORD_DIGEST_XWSS;
            break;
        case "5":
            security = Security.PASSWORD_DIGEST_WSS4J;
            break;
        case "6":
            security = Security.SIGNATURE_XWSS;
            break;
        case "7":
            security = Security.SIGNATURE_WSS4J;
            break;
        case "8":
            security = Security.ENCRYPTION_XWSS;
            break;
        case "9":
            security = Security.ENCRYPTION_WSS4J;
            break;
        default:
            security = null;
            break;
        }

        // Checks if it was a valid option
        if (security != null) {
            // Valid option
            // The client and URI are acquired
            client = clients.get(security);
            uri = uris.get(security);

            // The endpoint is queried
            printQueryHeader(uri, security, output);
            callEndpoint(client, uri, output, scanner);
        }
    } while (!"exit".equalsIgnoreCase(command));

    scanner.close();
}

From source file:info.mikaelsvensson.devtools.analysis.shared.reportprinter.PlainTextReportPrinter.java

private void printHeader(String text, boolean marginTop, PrintStream printStream) {
    if (marginTop) {
        printStream.println();
    }/*ww  w.ja  v a2s . c o m*/
    printStream.println(text);
    printStream.println(StringUtils.repeat('-', text.length()));
}

From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java

static void export(SSTableReader reader, PrintStream outs, String[] excludes) throws IOException {
    Set<String> excludeSet = new HashSet<String>();

    if (excludes != null)
        excludeSet = new HashSet<String>(Arrays.asList(excludes));

    SSTableIdentityIterator row;/*from  w ww  .  j a  va  2 s .c  o  m*/
    SSTableScanner scanner = reader.getDirectScanner();

    int i = 0;

    // collecting keys to export
    while (scanner.hasNext()) {
        row = (SSTableIdentityIterator) scanner.next();
        String currentKey = ByteBufferUtil.string(row.getKey().key);

        if (excludeSet.contains(currentKey))
            continue;

        serializeRow(row, row.getKey(), outs);
        outs.println();
        i++;
    }

    outs.flush();

    scanner.close();
}