Package org.apache.kafka.streams.kstream
Class Window
java.lang.Object
org.apache.kafka.streams.kstream.Window
A single window instance, defined by its start and end timestamp.
Window
is agnostic if start/end boundaries are inclusive or exclusive; this is defined by concrete
window implementations.
To specify how Window
boundaries are defined use Windows
.
For time semantics, see TimestampExtractor
.
- See Also:
-
Windows
TimeWindow
SessionWindow
UnlimitedWindow
TimestampExtractor
-
Field Summary
-
Constructor Summary
ConstructorDescriptionWindow
(long startMs, long endMs) Create a new window for the given start and end time. -
Method Summary
Modifier and TypeMethodDescriptionlong
end()
Return the end timestamp of this window.endTime()
Return the end time of this window.boolean
int
hashCode()
abstract boolean
Check if the given window overlaps with this window.long
start()
Return the start timestamp of this window.Return the start time of this window.toString()
-
Field Details
-
startMs
protected final long startMs -
endMs
protected final long endMs
-
-
Constructor Details
-
Window
Create a new window for the given start and end time.- Parameters:
startMs
- the start timestamp of the windowendMs
- the end timestamp of the window- Throws:
IllegalArgumentException
- ifstartMs
is negative or ifendMs
is smaller thanstartMs
-
-
Method Details
-
start
public long start()Return the start timestamp of this window.- Returns:
- The start timestamp of this window.
-
end
public long end()Return the end timestamp of this window.- Returns:
- The end timestamp of this window.
-
startTime
Return the start time of this window.- Returns:
- The start time of this window.
-
endTime
Return the end time of this window.- Returns:
- The end time of this window.
-
overlap
Check if the given window overlaps with this window. Should throw anIllegalArgumentException
if theother
window has a different type thanthis
window.- Parameters:
other
- another window of the same type- Returns:
true
ifother
overlaps with this window—false
otherwise
-
equals
-
hashCode
public int hashCode() -
toString
-