Package akka.http.impl.util
Class EnhancedString
java.lang.Object
scala.AnyVal
akka.http.impl.util.EnhancedString
public class EnhancedString
extends scala.AnyVal
INTERNAL API
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the ASCII encoded bytes of this string.boolean
endsWith
(char c) Determines whether the underlying String ends with the given character.scala.collection.immutable.LinearSeq<String>
fastSplit
(char delimiter) Splits the underlying string into the segments that are delimited by the given character.void
getAsciiBytes
(byte[] array, int offset) Copies the ASCII encoded bytes of this string into the given byte array starting at theoffset
index.scala.collection.immutable.Stream<String>
lazySplit
(char delimiter) Lazily splits the underlying string into the segments that are delimited by the given character.If the underlying string is null the method returns the empty string, otherwise the underlying string.boolean
startsWith
(char c) Determines whether the underlying String starts with the given character.stripMarginWithNewline
(String newline) Strips margin and fixes the newline sequence to the given one preventing dependencies on the build platformscala.Option<String>
toOption()
Returns Some(String) if the underlying string is non-empty, None otherwiseProvides a default toLowerCase that doesn't suffer from the dreaded turkish-i problem.
-
Constructor Details
-
EnhancedString
-
-
Method Details
-
underlying
-
fastSplit
Splits the underlying string into the segments that are delimited by the given character. The delimiter itself is never a part of any segment. If the string does not contain the delimiter the result is a List containing only the underlying string. Note that this implementation differs from the original String.split(...) method in that leading and trailing delimiters are NOT ignored, i.e. they trigger the inclusion of an empty leading or trailing empty string (respectively).- Parameters:
delimiter
- (undocumented)- Returns:
- (undocumented)
-
lazySplit
Lazily splits the underlying string into the segments that are delimited by the given character. Only the segments that are actually accessed are computed. The delimiter itself is never a part of any segment. If the string does not contain the delimiter the result is a single-element stream containing only the underlying string. Note that this implementation differs from the original String.split(...) method in that leading and trailing delimiters are NOT ignored, i.e. they trigger the inclusion of an empty leading or trailing empty string (respectively).- Parameters:
delimiter
- (undocumented)- Returns:
- (undocumented)
-
toOption
Returns Some(String) if the underlying string is non-empty, None otherwise- Returns:
- (undocumented)
-
nullAsEmpty
If the underlying string is null the method returns the empty string, otherwise the underlying string.- Returns:
- (undocumented)
-
asciiBytes
public byte[] asciiBytes()Returns the ASCII encoded bytes of this string. Truncates characters to 8-bit byte value.- Returns:
- (undocumented)
-
getAsciiBytes
public void getAsciiBytes(byte[] array, int offset) Copies the ASCII encoded bytes of this string into the given byte array starting at theoffset
index. Truncates characters to 8-bit byte value. If the array does not have enough space for the whole string only the portion that fits is copied.- Parameters:
array
- (undocumented)offset
- (undocumented)
-
startsWith
public boolean startsWith(char c) Determines whether the underlying String starts with the given character.- Parameters:
c
- (undocumented)- Returns:
- (undocumented)
-
endsWith
public boolean endsWith(char c) Determines whether the underlying String ends with the given character.- Parameters:
c
- (undocumented)- Returns:
- (undocumented)
-
stripMarginWithNewline
Strips margin and fixes the newline sequence to the given one preventing dependencies on the build platform -
toRootLowerCase
Provides a default toLowerCase that doesn't suffer from the dreaded turkish-i problem. See http://bugs.java.com/view_bug.do?bug_id=6208680- Returns:
- (undocumented)
-