我正在通过AudioInputStream将一个wav文件读入一个字节数组,
AudioInputStream audiofile = AudioSystem.getAudioInputStream(f);
byte[] audio=new byte[numberofframes*framesize];
int bytes=audiofile.read(audio);
Run Code Online (Sandbox Code Playgroud)
我是否需要安排样本的字节,考虑到数据以小端排列或者AudioInputStream是否为我做?
很久以前我安装了hadoop,但是如果我安装在伪分布式模式下,我不知何故忘记了.我怎么检查它?而我的hadoop正在运行
我试图从DOM Element对象继承,所有代码在我创建对象时运行正常,但是当我尝试调用appendChild()方法时,它给出了一个错误说:
MyObject doesn't have an appendChild method
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
var content=document.createTextNode("This was dynamically created");
function MyObject(tagName){
Element.constructor.call(this,tagName);
this.prototype=Element.prototype;
this.prototype=Object.defineProperties(this.prototype,{
newMethod:function(){
//dosomething
}
});
}
var newObj=new MyObject("div");
newObj.appendChild(content);
Run Code Online (Sandbox Code Playgroud) 我希望有一个像$
符号这样的简写,JQuery
用于快速引用在我的代码中广泛使用的对象.
怎么做到呢?
function Obj1(name){
this.__proto__={
Name:name,
getName:function(){
alert(this.Name);
}
};
}
function Obj2(name){
this.prototype={
Name:name,
getName:function(){
alert(this.Name);
};
};
}
x=new Obj1("blue shark");
z=new Obj2("red shark");
x.getName();
z.getName();// error:z.getName() is not a function
Run Code Online (Sandbox Code Playgroud)
这两者之间有什么区别?有人说prototype
仅用于构造函数,但在这种情况下它不起作用....相反,__proto__
工作为什么?
尝试使用一些自定义属性创建元素
function x(){
var f=document.createElement("div");
this.name="monkey";
return f;
}
x.prototype.myFunction=function(){
alert(arguments[0]+this.name);
};
var c=new x();
c.myFunction("hello");
Run Code Online (Sandbox Code Playgroud)
浏览器说c.myFunction不是一个函数