001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.protocol.ws.api.message; 018 019import org.apache.wicket.protocol.http.WebApplication; 020import org.apache.wicket.protocol.ws.api.registry.IKey; 021 022/** 023 * A {@link IWebSocketMessage message} with binary data 024 * 025 * @since 6.0 026 */ 027public class BinaryMessage extends AbstractClientMessage 028{ 029 private final byte[] data; 030 private final int offset; 031 private final int length; 032 033 /** 034 * Constructor. 035 * 036 * @param application 037 * the Wicket application 038 * @param sessionId 039 * the id of the http session 040 * @param key 041 * the page id or resource name 042 * @param data 043 * the binary message from the client 044 * @param offset 045 * the offset to read from 046 * @param length 047 */ 048 public BinaryMessage(WebApplication application, String sessionId, IKey key, byte[] data, int offset, int length) 049 { 050 super(application, sessionId, key); 051 this.data = data; 052 this.offset = offset; 053 this.length = length; 054 } 055 056 public final byte[] getData() 057 { 058 return data; 059 } 060 061 public final int getOffset() 062 { 063 return offset; 064 } 065 066 public final int getLength() 067 { 068 return length; 069 } 070}