Example usage for com.google.common.base Ascii LF

List of usage examples for com.google.common.base Ascii LF

Introduction

In this page you can find the example usage for com.google.common.base Ascii LF.

Prototype

byte LF

To view the source code for com.google.common.base Ascii LF.

Click Source Link

Document

Line Feed ('\n'): A format effector which controls the movement of the printing position to the next printing line.

Usage

From source file:se.softhouse.jargo.api.GreetingServer.java

void start(boolean loggingIsEnabled, List<Integer> ports, List<String> greetingPhrases) {
    if (loggingIsEnabled) {
        System.out.println(//from w  w w  .  ja  v  a2s .c  o  m
                "Starting server on port " + ports + ", will greet new connections with " + greetingPhrases);
    }
    try {
        for (Integer port : ports) {
            ServerSocket server = new ServerSocket(port, 10000);
            Socket client = server.accept();
            Writer writer = new OutputStreamWriter(client.getOutputStream(), Charsets.UTF_8);
            for (String greetingPhrase : greetingPhrases) {
                writer.append(greetingPhrase).append((char) Ascii.LF);
            }
            writer.close();
        }
    } catch (IOException e) {
        throw new RuntimeException("Bad shit happened", e);
    }
}