--------------------------------------------------------------------------- pc.copyBufferData()    Bufferに描画したデータを盤面へコピーする ---------------------------------------------------------------------------
12372
function(g,g2,x1,y1,x2,y2){
		// source側はtaranslateのぶん足されていないので、加算しておきます
		var sx1 = this.x0+x1*this.bw-1, sy1 = this.y0+y1*this.bh-1,
			sx2 = this.x0+x2*this.bw+2, sy2 = this.y0+y2*this.bh+2;
		if(sx1<0){ sx1=0;} if(sx2>g2.child.width) { sx2=g2.child.width;}
		if(sy1<0){ sy1=0;} if(sy2>g2.child.height){ sy2=g2.child.height;}
		g.drawImage(g2.child, sx1, sy1, (sx2-sx1), (sy2-sy1), sx1-this.x0, sy1-this.y0, (sx2-sx1), (sy2-sy1));
	}
396659
function toBuffer (object) {
  if (Buffer.isBuffer(object)) return object
  if (object.buffer) return object.buffer
  throw new TypeError('Could not output buffer type.')
}
1001975
function prepareBuffer(buffer, position) {
                var j;
                while (buffer[position] == undefined && buffer.length < getMaskLength()) {
                    j = 0;
                    while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer
                        buffer.push(getActiveBufferTemplate()[j++]);
                    }
                }

                return position;
            }
1016776
public void setData(IoBuffer buffer) {
        if (noCopy) {
            log.trace("Using buffer reference");
            this.data = buffer;
        } else {
            // try the backing array first if it exists
            if (buffer.hasArray()) {
                log.trace("Buffer has backing array, making a copy");
                byte[] copy = new byte[buffer.limit()];
                buffer.mark();
                buffer.get(copy);
                buffer.reset();
                data = IoBuffer.wrap(copy);
            } else {
                log.trace("Buffer has no backing array, using ByteBuffer");
                // fallback to ByteBuffer
                data.put(buffer.buf()).flip();
            }
        }
    }
774000
private void copyToStrBuffer(byte[] buffer, int offset, int length) {
    Preconditions.checkArgument(length >= 0);
    if (strBuffer.length - strBufferIndex < length) {
      // cannot fit, expanding buffer
      expandStrBuffer(length);
    }
    System.arraycopy(
      buffer, offset, strBuffer, strBufferIndex, Math.min(length, MAX_ALLOWABLE_BUFFER_SIZE - strBufferIndex));
    strBufferIndex += length;
  }
1360632
function(data) {

    var _mode = QRMode.MODE_ALPHA_NUM;
    var _data = data;

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return _data.length;
    };

    _this.write = function(buffer) {

      var s = _data;

      var i = 0;

      while (i + 1 < s.length) {
        buffer.put(
          getCode(s.charAt(i) ) * 45 +
          getCode(s.charAt(i + 1) ), 11);
        i += 2;
      }

      if (i < s.length) {
        buffer.put(getCode(s.charAt(i) ), 6);
      }
    };

    var getCode = function(c) {

      if ('0' <= c && c <= '9') {
        return c.charCodeAt(0) - '0'.charCodeAt(0);
      } else if ('A' <= c && c <= 'Z') {
        return c.charCodeAt(0) - 'A'.charCodeAt(0) + 10;
      } else {
        switch (c) {
        case ' ' : return 36;
        case '$' : return 37;
        case '%' : return 38;
        case '*' : return 39;
        case '+' : return 40;
        case '-' : return 41;
        case '.' : return 42;
        case '/' : return 43;
        case ':' : return 44;
        default :
          throw 'illegal char :' + c;
        }
      }
    };

    return _this;
  }
1071431
function initBuffer(data) {
        // Create a new buffer to receive data if needed
        if (buffer === null) {
            buffer = new ByteBuffer(initBufferSize);
        }
        buffer.append(data);
        buffer.flip();
    }
715054
function stringToBuffer(str) {
    var buf = new Buffer(str.length);
    for (var i = 0; i < buf.length; i++) {
      buf.writeUInt8(str.charCodeAt(i), i);
    }
    return buf;
  }
208240
function bufferFromFile( filename ) {
	console.info( ("Loading "+filename).grey );
	var buf = fs.readFileSync( filename ),	// Load Buffer
    	ab = new ArrayBuffer( buf.length ),	// Create an ArrayBuffer to fit the data
    	view = new Uint8Array(ab);			// Create an Uint8Array view

    // Copy buffer into view
    for (var i = 0; i < buf.length; ++i)
        view[i] = buf[i];

    // Return buffer view
    return view;
}
1215723
private void dataBufferAppend(char[] ch, int start, int length) {
        dataBuffer = (char[]) extendArray(dataBuffer, dataBuffer.length,
                dataBufferPos + length);

        System.arraycopy(ch, start, dataBuffer, dataBufferPos, length);
        dataBufferPos += length;
    }
761127
function(e){
		this.btn = pzpr.util.getMouseButton(e);
		
		// SHIFTキー/Commandキーを押している時は左右ボタン反転
		var kc = this.puzzle.key;
		kc.checkmodifiers(e);
		if(((kc.isSHIFT || kc.isMETA) !== this.inversion) || this.inputMode==='number-'){
			if     (this.btn==='left'){ this.btn = 'right';}
			else if(this.btn==='right'){ this.btn = 'left';}
		}
	}
258342
function(){
		var lines = this.fstr.split("\n");
		var firstline = lines.shift();
		delete this.fstr;
		
		/* ヘッダからパズルの種類・ファイルの種類を判定する */
		if(firstline.match(/^pzprv3/)){
			this.type = FILE_PZPR;
			if(firstline.match(/pzprv3\.(\d+)/)){ this.filever = +RegExp.$1;}
			this.pid = lines.shift();
			this.qdata = lines.join("\n");
		}
		else if(firstline.match(/^\<\?xml/)){ // jshint ignore:line
			this.type = FILE_PBOX_XML;
			lines.unshift(firstline);
			this.qdata = lines.join("\n");
			if(!!DOMParser){
				this.body = (new DOMParser()).parseFromString(this.qdata, 'text/xml');
				this.pid = this.body.querySelector('puzzle').getAttribute('type');
			}
			else{ this.pid = '';}
		}
		else if(firstline.match(/^\d+$/)){
			this.type = FILE_PBOX;
			lines.unshift(firstline);
			this.qdata = lines.join("\n");
		}
		else{
			this.pid = '';
		}
		this.pid = pzpr.variety.toPID(this.pid);
		
		return (!!this.pid);
	}
1011438
function(bufferOrArray, callback) {
    var self = this,
        ix = this.offset,
        frame = [],
        isArray = Object.prototype.toString.call( bufferOrArray) === '[object Array]';

    self.frameIx = 0;

    while (ix < bufferOrArray.length) {
      var value = isArray ? bufferOrArray[ix] : bufferOrArray['read' + self.sampleType](ix); 

      frame.push(this.map ? this.map[value] : value);

      if (frame.length == this.frameSize || ix+self.wordSize == bufferOrArray.length) finishFrame(frame);

      ix += self.wordSize;
    }

    // Did we not process any frames at all for some reason?
    if (this.frameIx == 0) callback(undefined);

    function finishFrame(frame) {
      if (this.scale) frame = frame.map(function (s, ix) {return s * self.scale[ix];});

      callback(frame, self.frameIx);

      if (ix != bufferOrArray.length - self.wordSize)
      {
          ix -= (self.frameSize - self.frameStep) * self.wordSize;

          self.frameIx++;
          frame.length = 0;
      }
    }
  }
639060
function(){
		var loopcount = 0;

		while(1){
			var Rdeg = ((Math.random() * 384)|0)-64; if(Rdeg<0){Rdeg=0;} if(Rdeg>255){Rdeg=255;}
			var Gdeg = ((Math.random() * 384)|0)-64; if(Gdeg<0){Gdeg=0;} if(Gdeg>255){Gdeg=255;}
			var Bdeg = ((Math.random() * 384)|0)-64; if(Bdeg<0){Bdeg=0;} if(Bdeg>255){Bdeg=255;}

			// HLSの各組成値を求める
			var Cmax = Math.max(Rdeg,Math.max(Gdeg,Bdeg));
			var Cmin = Math.min(Rdeg,Math.min(Gdeg,Bdeg));

			var Hdeg = 0;
			var Ldeg = (Cmax+Cmin)*0.5 / 255;
			var Sdeg = (Cmax===Cmin?0:(Cmax-Cmin)/((Ldeg<=0.5)?(Cmax+Cmin):(2*255-Cmax-Cmin)) );

			if(Cmax===Cmin){ Hdeg = 0;}
			else if(Rdeg>=Gdeg && Rdeg>=Bdeg){ Hdeg = (    60*(Gdeg-Bdeg)/(Cmax-Cmin)+360)%360;}
			else if(Gdeg>=Rdeg && Gdeg>=Bdeg){ Hdeg = (120+60*(Bdeg-Rdeg)/(Cmax-Cmin)+360)%360;}
			else if(Bdeg>=Gdeg && Bdeg>=Rdeg){ Hdeg = (240+60*(Rdeg-Gdeg)/(Cmax-Cmin)+360)%360;}

			// YCbCrのYを求める
			var Ydeg = (0.29891*Rdeg + 0.58661*Gdeg + 0.11448*Bdeg) / 255;

			if( (this.minYdeg<Ydeg && Ydeg<this.maxYdeg) && (Math.abs(this.lastYdeg-Ydeg)>0.15) && (Sdeg<0.02 || 0.40<Sdeg) &&
				 (((360+this.lastHdeg-Hdeg)%360>=45)&&((360+this.lastHdeg-Hdeg)%360<=315)) ){
				this.lastHdeg = Hdeg;
				this.lastYdeg = Ydeg;
				//alert("rgb("+Rdeg+", "+Gdeg+", "+Bdeg+")\nHLS("+(Hdeg|0)+", "+(""+((Ldeg*1000)|0)*0.001).slice(0,5)+", "+(""+((Sdeg*1000|0))*0.001).slice(0,5)+")\nY("+(""+((Ydeg*1000)|0)*0.001).slice(0,5)+")");
				return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";
			}

			loopcount++;
			if(loopcount>100){ return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";}
		}
	}
1006083
@Override
  public void writeStringData(String value, int offset, int length)
  {
    char []cBuf = _charBuffer;
    int cBufLength = cBuf.length;
    
    for (int i = 0; i < length; i += cBufLength) {
      int sublen = Math.min(length - i, cBufLength);
      
      value.getChars(offset + i, offset + i + sublen, cBuf, 0);
      
      writeStringChunk(cBuf, 0, sublen);
    }
  }
11557
@SuppressWarnings("unchecked")
  private P byteBufferToPage(ByteBuffer buffer) {
    try (InputStream bais = new ByteBufferInputStream(buffer);
        ObjectInputStream ois = new ObjectInputStream(bais)) {
      int type = ois.readInt();
      if (type == EMPTY_PAGE) {
        return null;
      } else if (type == FILLED_PAGE) {
        return (P) ois.readObject();
      } else {
        throw new IllegalArgumentException("Unknown type: " + type);
      }
    } catch (IOException|ClassNotFoundException e) {
      LoggingUtil.exception(e);
      return null;
    }
  }
170314
public static ByteBuf copiedBuffer(char[] array, Charset charset) {
        if (array == null) {
            throw new NullPointerException("array");
        }
        return copiedBuffer(array, 0, array.length, charset);
    }