@@ -30,13 +30,10 @@ struct Blob_;
3030
3131class Buffer : public ObjectWrap {
3232 public:
33- static v8::Persistent<v8::FunctionTemplate> constructor_template;
34-
35- Buffer (size_t length);
36- Buffer (Buffer *parent, size_t start, size_t end);
3733 ~Buffer ();
3834
3935 static void Initialize (v8::Handle<v8::Object> target);
36+ static Buffer* New (size_t length); // public constructor
4037 static inline bool HasInstance (v8::Handle<v8::Value> val) {
4138 if (!val->IsObject ()) return false ;
4239 v8::Local<v8::Object> obj = val->ToObject ();
@@ -47,7 +44,12 @@ class Buffer : public ObjectWrap {
4744 size_t length () const { return length_; }
4845 struct Blob_ * blob () const { return blob_; }
4946
50- protected:
47+ int AsciiWrite (char *string, int offset, int length);
48+ int Utf8Write (char *string, int offset, int length);
49+
50+ private:
51+ static v8::Persistent<v8::FunctionTemplate> constructor_template;
52+
5153 static v8::Handle<v8::Value> New (const v8::Arguments &args);
5254 static v8::Handle<v8::Value> Slice (const v8::Arguments &args);
5355 static v8::Handle<v8::Value> BinarySlice (const v8::Arguments &args);
@@ -60,10 +62,9 @@ class Buffer : public ObjectWrap {
6062 static v8::Handle<v8::Value> Unpack (const v8::Arguments &args);
6163 static v8::Handle<v8::Value> Copy (const v8::Arguments &args);
6264
63- int AsciiWrite ( char *string, int offset, int length);
64- int Utf8Write ( char *string, int offset, int length );
65+ Buffer ( size_t length);
66+ Buffer (Buffer *parent, size_t start, size_t end );
6567
66- private:
6768 size_t off_; // offset inside blob_
6869 size_t length_; // length inside blob_
6970 struct Blob_ *blob_;
0 commit comments