1 /*
2  * Copyright 2002-2017 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 module hunt.stomp.converter.ByteArrayMessageConverter;
18 
19 import hunt.stomp.converter.AbstractMessageConverter;
20 
21 import hunt.stomp.Message;
22 import hunt.stomp.MessageHeaders;
23 // import hunt.framework.util.MimeTypeUtils;
24 import hunt.util.MimeType;
25 import hunt.logging;
26 
27 /**
28  * A {@link MessageConverter} that supports MIME type "application/octet-stream" with the
29  * payload converted to and from a byte[].
30  *
31  * @author Rossen Stoyanchev
32  * @since 4.0
33  */
34 class ByteArrayMessageConverter : AbstractMessageConverter {
35 
36 	this() {
37 		super(new MimeType("application/octet-stream"));
38 	}
39 
40 
41 	override
42 	protected bool supports(TypeInfo typeInfo) {
43 		// version(HUNT_DEBUG) tracef("checking message type, expected: %s, actual: %s", 
44 		// 	typeid(string), typeInfo);
45 		return (typeid(byte[]) == typeInfo);
46 	}
47 
48 	// override
49 	// protected Object convertFromInternal(
50 	// 		MessageBase message, Class<?> targetClass, Object conversionHint) {
51 
52 	// 	return message.getPayload();
53 	// }
54 
55 	// override
56 	// protected Object convertToInternal(
57 	// 		Object payload, MessageHeaders headers, Object conversionHint) {
58 
59 	// 	return payload;
60 	// }
61 
62 }