Class UTF8Checker
- java.lang.Object
-
- io.undertow.websockets.core.protocol.version07.UTF8Checker
-
- All Implemented Interfaces:
ChannelFunction
public class UTF8Checker extends Object implements ChannelFunction
An utility class which can be used to check if a sequence of bytes or ByteBuffers contain non UTF-8 data.Please use a new instance per stream.
- Author:
- Norman Maurer
-
-
Constructor Summary
Constructors Constructor Description UTF8Checker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterRead(ByteBuffer buf, int position, int length)
Is called on theByteBuffer
after a read operation completesvoid
beforeWrite(ByteBuffer buf, int position, int length)
Is called on theByteBuffer
before a write operation completesvoid
complete()
Is called to complete theChannelFunction
.void
newFrame(FrameHeaderData headerData)
-
-
-
Method Detail
-
newFrame
public void newFrame(FrameHeaderData headerData)
- Specified by:
newFrame
in interfaceChannelFunction
-
afterRead
public void afterRead(ByteBuffer buf, int position, int length) throws IOException
Description copied from interface:ChannelFunction
Is called on theByteBuffer
after a read operation completes- Specified by:
afterRead
in interfaceChannelFunction
- Parameters:
buf
- theByteBuffer
to operate onposition
- the index in theByteBuffer
to start fromlength
- the number of bytes to operate on- Throws:
IOException
- thrown if an error occurs
-
beforeWrite
public void beforeWrite(ByteBuffer buf, int position, int length) throws UnsupportedEncodingException
Description copied from interface:ChannelFunction
Is called on theByteBuffer
before a write operation completes- Specified by:
beforeWrite
in interfaceChannelFunction
- Parameters:
buf
- theByteBuffer
to operate onposition
- the index in theByteBuffer
to start fromlength
- the number of bytes to operate on- Throws:
UnsupportedEncodingException
-
complete
public void complete() throws UnsupportedEncodingException
Description copied from interface:ChannelFunction
Is called to complete theChannelFunction
. Access it after complete is called may result in unexpected behavior.- Specified by:
complete
in interfaceChannelFunction
- Throws:
UnsupportedEncodingException
-
-