@Immutable
public abstract class PipeRequest
extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PipeRequest.LogLevel
Log level.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG_LEVEL
Debug level.
|
static String |
ERROR_LEVEL
Error level.
|
static String |
FATAL_LEVEL
Fatal level.
|
static String |
INFO_LEVEL
Info level.
|
static String |
LINE_SEPARATOR
Line separator.
|
static Pattern |
SPACE_PATTERN
Space pattern.
|
static String |
TRACE_LEVEL
Trace level.
|
static String |
WARN_LEVEL
Warn level.
|
Modifier | Constructor and Description |
---|---|
protected |
PipeRequest(String requestID,
int version)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
static String |
cleanString(String string)
Cleans a string by replacing control chars with spaces.
|
static void |
debug(Messages.Entry entry,
Object... params)
Logs a message at the DEBUG level.
|
static void |
debug(String format,
Object... params)
Logs a message at the DEBUG level.
|
static RuntimeException |
error(Messages.Entry entry,
Object... params)
Logs a message at the ERROR level.
|
static RuntimeException |
error(String format,
Object... params)
Logs a message at the ERROR level.
|
static RuntimeException |
fatal(Messages.Entry entry,
Object... params)
Logs a message at the FATAL level.
|
static RuntimeException |
fatal(String format,
Object... params)
Logs a message at the FATAL level.
|
protected static Optional<String> |
firstLine()
Returns the first line for a request.
|
String |
getRequestID()
Gets the request ID.
|
int |
getVersion()
Gets the version.
|
static void |
info(Messages.Entry entry,
Object... params)
Logs a message at the INFO level.
|
static void |
info(String format,
Object... params)
Logs a message at the INFO level.
|
static void |
log(PipeRequest.LogLevel level,
Messages.Entry entry,
Object... params)
Logs a message at the specified level.
|
static void |
log(PipeRequest.LogLevel level,
String format,
Object... params)
Logs a message at the specified level.
|
protected static String |
nextLine()
Returns the next line for a request.
|
protected static PointValue |
nextPointValue(boolean stampRequired)
Returns the point value from the next input line.
|
protected static int |
parseInt(String text)
Parses an int.
|
static String |
pointValueToString(PointValue pointValue)
Converts a point value to a string.
|
static PointValue |
stringToPointValue(String string)
Converts a string to a point value.
|
static void |
trace(Messages.Entry entry,
Object... params)
Logs a message at the TRACE level.
|
static void |
trace(String format,
Object... params)
Logs a message at the TRACE level.
|
static void |
warn(Messages.Entry entry,
Object... params)
Logs a message at the WARN level.
|
static void |
warn(String format,
Object... params)
Logs a message at the WARN level.
|
protected static void |
writeLine(String line)
Writes a line.
|
protected static void |
writePointValue(PointValue pointValue)
Writes a point value.
|
public static final String DEBUG_LEVEL
public static final String ERROR_LEVEL
public static final String FATAL_LEVEL
public static final String INFO_LEVEL
public static final String LINE_SEPARATOR
public static final Pattern SPACE_PATTERN
public static final String TRACE_LEVEL
public static final String WARN_LEVEL
protected PipeRequest(@Nonnull String requestID, int version)
requestID
- The request ID.version
- The request format version.@Nonnull @CheckReturnValue public static String cleanString(@Nonnull String string)
string
- The string to clean.public static void debug(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.public static void debug(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.@Nonnull @CheckReturnValue public static RuntimeException error(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.@Nonnull @CheckReturnValue public static RuntimeException error(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.@Nonnull @CheckReturnValue public static RuntimeException fatal(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.@Nonnull @CheckReturnValue public static RuntimeException fatal(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.public static void info(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.public static void info(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.public static void log(@Nonnull PipeRequest.LogLevel level, @Nonnull Messages.Entry entry, @Nonnull Object... params)
level
- The log level.entry
- The messages entry.params
- The message parameters.public static void log(@Nonnull PipeRequest.LogLevel level, @Nonnull String format, @Nonnull Object... params)
level
- The log level.format
- The message format.params
- The message parameters.@Nonnull @CheckReturnValue public static String pointValueToString(@Nonnull PointValue pointValue)
pointValue
- The point value.@Nullable @CheckReturnValue public static PointValue stringToPointValue(@Nonnull String string)
string
- The string.public static void trace(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.public static void trace(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.public static void warn(@Nonnull Messages.Entry entry, @Nonnull Object... params)
entry
- The messages entry.params
- The message parameters.public static void warn(@Nonnull String format, @Nonnull Object... params)
format
- The message format.params
- The message parameters.@Nonnull @CheckReturnValue public final String getRequestID()
@Nonnull @CheckReturnValue public final int getVersion()
@Nonnull @CheckReturnValue protected static Optional<String> firstLine()
Drops lines containing only whitespace characters. Also recognizes synchronization requests and responds.
@Nonnull @CheckReturnValue protected static String nextLine()
Drops lines containing only whitespace characters.
@Nonnull @CheckReturnValue protected static PointValue nextPointValue(boolean stampRequired)
stampRequired
- True if a stamp is required.@CheckReturnValue protected static int parseInt(@Nonnull String text)
text
- The text representation.protected static void writeLine(@Nonnull String line)
line
- The line.protected static void writePointValue(@Nonnull PointValue pointValue)
pointValue
- The point value.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.