class RegexLimitingStream extends InputStream
Can be used with any InputStream to restrict what is read from it to stop before a particular regex match.
The regex must have a finite maximum length match string.
This can be used to forcibly stop consumption of data from a stream at a length obtained from a delimiter that is described using a regex.
The delimiter matching the regex is consumed from the underlying stream (if found), and the underlying stream is left positioned at the byte after the regex match string.
IMPORTANT: The delimiter regex cannot contain any Capturing Groups! Use (?: ... ) which is non-capturing, instead of regular ( ... ). For example: this regex matches CRLF not followed by tab or space:
"""\r\n(?!(?:\t|\ ))"""
Notice use of the ?: to avoid a capture group around the alternatives of tab or space.
Thread safety: This is inherently stateful - so not thread safe to use this object from more than one thread.
- Alphabetic
- By Inheritance
- RegexLimitingStream
- InputStream
- Closeable
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new RegexLimitingStream(inputStream: InputStream, regexForDelimiter: String, maximumLengthDelimiterExample: String, charset: Charset, targetChunkSize: Int = 32 * 1024)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
available(): Int
- Definition Classes
- RegexLimitingStream → InputStream
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
close(): Unit
- Definition Classes
- RegexLimitingStream → InputStream → Closeable → AutoCloseable
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mark(arg0: Int): Unit
- Definition Classes
- InputStream
-
def
markSupported(): Boolean
- Definition Classes
- InputStream
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
read(): Int
- Definition Classes
- RegexLimitingStream → InputStream
-
def
read(arg0: Array[Byte], arg1: Int, arg2: Int): Int
- Definition Classes
- InputStream
- Annotations
- @throws( classOf[java.io.IOException] )
-
def
read(arg0: Array[Byte]): Int
- Definition Classes
- InputStream
- Annotations
- @throws( classOf[java.io.IOException] )
-
def
reset(): Unit
- Definition Classes
- InputStream
- Annotations
- @throws( classOf[java.io.IOException] )
-
def
skip(arg0: Long): Long
- Definition Classes
- InputStream
- Annotations
- @throws( classOf[java.io.IOException] )
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()