FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/src/node_buffer.h at master · greco/node · GitHub
greco
/
node
Public
forked from
nodejs/node-v0.x-archive
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
src
/
node_buffer.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
77 lines (60 loc) · 2.54 KB
Breadcrumbs
node
/
src
/
node_buffer.h
Copy path
File metadata and controls
77 lines (60 loc) · 2.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
ifndef
NODE_BUFFER_H_
#
define
NODE_BUFFER_H_
#
include
<
node.h
>
#
include
<
node_object_wrap.h
>
#
include
<
v8.h
>
namespace
node
{
/*
A buffer is a chunk of memory stored outside the V8 heap, mirrored by an
* object in javascript. The object is not totally opaque, one can access
* individual bytes with [] and slice it into substrings or sub-buffers
* without copying memory.
*
* // return an ascii encoded string - no memory iscopied
* buffer.asciiSlide(0, 3)
*
* // returns another buffer - no memory is copied
* buffer.slice(0, 3)
*
* Interally, each javascript buffer object is backed by a "struct buffer"
* object. These "struct buffer" objects are either a root buffer (in the
* case that buffer->root == NULL) or slice objects (in which case
* buffer->root != NULL). A root buffer is only GCed once all its slices
* are GCed.
*/
struct
Blob_
;
class
Buffer
:
public
ObjectWrap
{
public:
~Buffer
();
static
void
Initialize
(v8::Handle<v8::Object> target);
static
Buffer*
New
(
size_t
length);
//
public constructor
static
bool
HasInstance
(v8::Handle<v8::Value> val);
static
char
*
Data
(v8::Handle<v8::Object>);
static
size_t
Length
(v8::Handle<v8::Object>);
char
*
data
();
size_t
length
()
const
{
return
length_; }
int
AsciiWrite
(
char
*string,
int
offset,
int
length);
int
Utf8Write
(
char
*string,
int
offset,
int
length);
private:
static
v8::Persistent<v8::FunctionTemplate> constructor_template;
static
v8::Handle<v8::Value>
New
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Slice
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
BinarySlice
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
AsciiSlice
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Base64Slice
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Utf8Slice
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
BinaryWrite
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Base64Write
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
AsciiWrite
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Utf8Write
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
ByteLength
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
MakeFastBuffer
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Unpack
(
const
v8::Arguments &args);
static
v8::Handle<v8::Value>
Copy
(
const
v8::Arguments &args);
Buffer
(
size_t
length);
Buffer
(Buffer *parent,
size_t
start,
size_t
end);
size_t
off_;
size_t
length_;
char
* data_;
};
}
//
namespace node buffer
#
endif
//
NODE_BUFFER_H_
Back
|
FazBrowse Home
|
New Git URL