DCL
4.0
Loading...
Searching...
No Matches
HttpStream.cpp
Go to the documentation of this file.
1
2
#include <
dcl/Object.h
>
3
#if __DCL_HAVE_ALLOC_DEBUG
4
#undef __DCL_ALLOC_LEVEL
5
#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
6
#endif
7
8
#include <
dcl/HttpServlet.h
>
9
#include <
dcl/HttpStream.h
>
10
11
#define __DEBUG_THIS 0
12
#if __DEBUG_THIS
13
#define __DCL_TRACE1_N __DCL_TRACE1
14
#define __DCL_TRACE2_N __DCL_TRACE2
15
#define __DCL_TRACE3_N __DCL_TRACE3
16
#else
17
#define __DCL_TRACE1_N(fmt, arg)
18
#define __DCL_TRACE2_N(fmt, arg1, arg2)
19
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
20
#endif
21
22
#if __DCL_DEBUG
23
#undef __THIS_FILE__
24
static
const
char_t
*
__THIS_FILE__
=
__T
(
"dcl/HttpStream.cpp"
);
25
#endif
26
27
__DCL_BEGIN_NAMESPACE
28
29
IMPLEMENT_CLASSINFO
(
HttpInputStream
,
InputStream
)
30
31
HttpInputStream::HttpInputStream(
32
HttpServletContext
* _ctx
33
)
34
{
35
__DCL_ASSERT
(_ctx !=
NULL
);
36
__ctx
= _ctx;
37
}
38
39
size_t
HttpInputStream::read(
40
void
* _buf,
41
size_t
_n
42
)
__DCL_THROWS1
(
IOException
*)
43
{
44
size_t
nTotalRead = 0;
45
while
(nTotalRead < _n) {
46
size_t
nRead = __ctx->read(
47
(
void
*)(((
byte_t
*)_buf) + nTotalRead),
48
_n - nTotalRead
49
);
50
if
(nRead)
51
nTotalRead += nRead;
52
else
{
53
break
;
54
}
55
}
56
return
nTotalRead;
57
}
58
59
IMPLEMENT_CLASSINFO
(
HttpOutputStream
,
OutputStream
)
60
61
HttpOutputStream::HttpOutputStream(
HttpServletContext
* _ctx)
62
{
63
__DCL_ASSERT
(_ctx !=
NULL
);
64
__ctx = _ctx;
65
}
66
67
OutputStream
& HttpOutputStream::write(
const
void
* _buf,
size_t
_n)
68
__DCL_THROWS1
(
IOException
*)
69
{
70
__ctx->write(_buf, _n);
71
return
*
this
;
72
}
73
74
__DCL_END_NAMESPACE
__THIS_FILE__
#define __THIS_FILE__
Definition
_trace.h:14
NULL
#define NULL
Definition
Config.h:340
char_t
wchar_t char_t
Definition
Config.h:275
byte_t
unsigned char byte_t
Definition
Config.h:274
__DCL_THROWS1
#define __DCL_THROWS1(e)
Definition
Config.h:167
HttpServlet.h
HttpStream.h
Object.h
__DCL_ASSERT
#define __DCL_ASSERT(expr)
Definition
Object.h:371
IMPLEMENT_CLASSINFO
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
Definition
Object.h:228
__T
#define __T(str)
Definition
Object.h:44
HttpInputStream
Definition
HttpStream.h:16
HttpInputStream::__ctx
HttpServletContext * __ctx
Definition
HttpStream.h:25
HttpOutputStream
Definition
HttpStream.h:29
HttpServletContext
Definition
HttpServlet.h:34
IOException
Definition
Exception.h:93
InputStream
Definition
InputStream.h:23
OutputStream
Definition
OutputStream.h:31
src
DCLCore
HttpStream.cpp
Generated by
1.14.0