File tree 1 file changed +47
-0
lines changed
providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/request/body 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2014 AsyncHttpClient Project. All rights reserved.
3
+ *
4
+ * This program is licensed to you under the Apache License Version 2.0,
5
+ * and you may not use this file except in compliance with the Apache License Version 2.0.
6
+ * You may obtain a copy of the Apache License Version 2.0 at
7
+ * http://www.apache.org/licenses/LICENSE-2.0.
8
+ *
9
+ * Unless required by applicable law or agreed to in writing,
10
+ * software distributed under the Apache License Version 2.0 is distributed on an
11
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
13
+ */
14
+ package org .asynchttpclient .providers .netty3 .request .body ;
15
+
16
+ import org .jboss .netty .buffer .ChannelBuffer ;
17
+ import org .jboss .netty .buffer .ChannelBuffers ;
18
+
19
+ public class NettyByteArrayBody extends NettyDirectBody {
20
+
21
+ private final byte [] bytes ;
22
+ private final String contentType ;
23
+
24
+ public NettyByteArrayBody (byte [] bytes ) {
25
+ this (bytes , null );
26
+ }
27
+
28
+ public NettyByteArrayBody (byte [] bytes , String contentType ) {
29
+ this .bytes = bytes ;
30
+ this .contentType = contentType ;
31
+ }
32
+
33
+ @ Override
34
+ public long getContentLength () {
35
+ return bytes .length ;
36
+ }
37
+
38
+ @ Override
39
+ public String getContentType () {
40
+ return contentType ;
41
+ }
42
+
43
+ @ Override
44
+ public ChannelBuffer channelBuffer () {
45
+ return ChannelBuffers .wrappedBuffer (bytes );
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments