亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? message.java

?? tinyos-2.x.rar
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
// $Id: Message.java,v 1.6 2007/05/29 16:44:50 rincon Exp $

/*									tab:4
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
/* Authors:  David Gay  <dgay@intel-research.net>
 *           Intel Research Berkeley Lab
 *
 */

/**
 * Message class (encode/decode tinyos messages).<p>
 *
 * The base class for encoding and decoding tinyos messages.  Provides
 * methods to read and write bit fields at an offset for a particular bit
 * length.  Intended for use by the Java code generated by mig.
 *
 * @version	1, 15 Jul 2002
 * @author	David Gay
 * @author David Gay <dgay@intel-research.net>
 * @author Intel Research Berkeley Lab
 */
package net.tinyos.message;

public class Message implements Cloneable {

  /**
   * The maximum number of characters read from an 8-bit array field being
   * converted into a Java String.
   */
  public static final int MAX_CONVERTED_STRING_LENGTH = 512;

  /**
   * The underlying byte array storing the data for this message. This is
   * private to enforce access to the data through the accessor methods in this
   * class, which do bounds checking and manage the base_offset for embedded
   * messages.
   */
  private byte[] data;

  /**
   * The base offset into the data. This allows the message data to exist at
   * some non-zero offset into the actual data.
   */
  protected int base_offset;

  /**
   * The actual length of the message data. Must be less than or equal to
   * (data.length - base_offset).
   */
  protected int data_length;

  /**
   * The AM type corresponding to this object. Set to -1 if no AM type is known.
   */
  protected int am_type;

  /** The serial packet this message originated from */
  private SerialPacket serialPacket;
  
  /** Limit no-arg instantiation. */
  protected Message() {
  }

  /**
   * Construct a new message of the given size.
   * 
   * @param data_length
   *          The size of the message to create.
   */
  public Message(int data_length) {
    init(data_length);
  }

  public void init(int data_length) {
    init(new byte[data_length]);
  }

  /**
   * Construct a new message of the given size and base offset. Allocates a new
   * byte array of size data_length+base_offset.
   * 
   * @param data_length
   *          The size of the message to create.
   * @param base_offset
   *          The base offset into the newly created message.
   */
  public Message(int data_length, int base_offset) {
    init(data_length, base_offset);
  }

  protected void init(int data_length, int base_offset) {
    init(new byte[data_length + base_offset], base_offset);
  }

  /**
   * Construct a message using data as the storage. The length of data
   * determines the length of this message.
   * 
   * @param data
   *          the storage for this message
   */
  public Message(byte[] data) {
    init(data);
  }

  protected void init(byte[] data) {
    init(data, 0);
  }

  /**
   * Construct a message using data as the storage. Use the given base_offset as
   * the base offset into the data array. The data length will be (data.length -
   * base_offset).
   * 
   * @param data
   *          the storage for this message
   * @param base_offset
   *          the base offset into the data array
   */
  public Message(byte[] data, int base_offset) {
    init(data, base_offset);
  }

  protected void init(byte[] data, int base_offset) {
    init(data, base_offset, data.length - base_offset);
  }

  /**
   * Construct a message using data as the storage. Use the given base_offset as
   * the base offset into the data array, and the specified data length.
   * 
   * @param data
   *          the storage for this message
   * @param base_offset
   *          the base offset into the data array
   * @param data_length
   *          the length of the message data
   */
  public Message(byte[] data, int base_offset, int data_length) {
    init(data, base_offset, data_length);
  }

  protected void init(byte[] data, int base_offset, int data_length) {
    this.data = data;
    this.base_offset = base_offset;
    this.data_length = data_length;
    if (base_offset + data_length > data.length)
      throw new ArrayIndexOutOfBoundsException(
          "Cannot create Message with base_offset " + base_offset
              + ", data_length " + data_length + " and data array size "
              + data.length);
  }

  /**
   * Construct an embedded message within the given 'msg'. Use the given
   * base_offset as the base offset into the data array, and the specified data
   * length.
   * 
   * @param msg
   *          the message to embed this message into
   * @param base_offset
   *          the base offset into the data array
   * @param data_length
   *          the length of the message data
   */
  public Message(Message msg, int base_offset, int data_length) {
    init(msg, base_offset, data_length);
  }

  protected void init(Message msg, int base_offset, int data_length) {
    init(msg.dataGet(), msg.base_offset + base_offset, data_length);
  }

  private Message cloneself() {
    Message copy;

    try {
      copy = (Message) super.clone();
    } catch (CloneNotSupportedException e) {
      System.err
          .println("Message: WARNING: CloneNotSupportedException in cloneself(): "
              + e);
      System.err
          .println("Message: This is a bug - please contact dgay@intel-research.net");
      copy = null;
      System.exit(2);
    }
    return copy;
  }

  /**
   * Clone this Message, including making a copy of its data
   */
  public Object clone() {
    Message copy = cloneself();
    copy.init((byte[]) data.clone(), base_offset, data_length);
    copy.am_type = this.am_type;
    return copy;
  }

  /**
   * Clone this Message, but give it a new unitialised data array of size size
   * 
   * @param size
   *          size of the new data array
   */
  public Message clone(int size) {
    Message copy = cloneself();
    copy.init(new byte[size], 0, size);
    copy.am_type = this.am_type;
    return copy;
  }

  /**
   * Copy new data for this message from 'data'. Copies min(data.length,
   * this.data_length) bytes.
   * 
   * @param data
   *          the array containing the data to be copied
   * @exception ArrayIndexOutOfBoundsException
   *              if any of data[0..getData().length - 1] are invalid
   */
  public void dataSet(byte[] data) {
    dataSet(data, 0, this.base_offset, Math.min(this.data_length, data.length));
  }

  /**
   * Copy new data for this message from offsetFrom in data to offsetTo in this
   * message. Copies a total of length bytes
   * 
   * @param data
   *          the array containing the data to be copied
   * @param offsetFrom
   *          the offset in data to start copying from
   * @param offsetTo
   *          the offset at which to start copying data into this message.
   * @param length
   *          bytes are copied.
   * @exception ArrayIndexOutOfBoundsException
   *              if any of the source or target indices are invalid
   */
  public void dataSet(byte[] data, int offsetFrom, int offsetTo, int length) {
    System.arraycopy(data, offsetFrom, this.data, offsetTo + base_offset,
        length);
  }

  /**
   * Copy new data for this message from the raw data in msg to offsetTo in this
   * message. Copies a total of msg.dataLength() bytes
   * 
   * @param msg
   *          the message containing the data to be copied
   * @param offsetTo
   *          the offset at which to start copying data into this message.
   * @exception ArrayIndexOutOfBoundsException
   *              if any of the target indices are invalid
   */
  public void dataSet(Message msg, int offsetTo) {
    System.arraycopy(msg.dataGet(), msg.baseOffset(), this.data, offsetTo
        + base_offset, msg.dataLength());
  }

  /**
   * Return the raw byte array representing the data of this message. Note that
   * only indices in the range (this.baseOffset(),
   * this.baseOffset()+this.dataLength()) are valid.
   */
  public byte[] dataGet() {
    return data;
  }

  /**
   * Return the base offset into the data array for this message.
   */
  public int baseOffset() {
    return base_offset;
  }

  /**
   * Return the length of the data (in bytes) contained in this message.
   */
  public int dataLength() {
    return data_length;
  }

  /**
   * Return the active message type of this message (-1 if unknown)
   */
  public int amType() {
    return am_type;
  }

  /**
   * Set the active message type of this message
   */
  public void amTypeSet(int type) {
    this.am_type = type;
  }

  // Check that length bits from offset are in bounds
  private void checkBounds(int offset, int length) {
    if (offset < 0 || length <= 0 || offset + length > (data_length * 8))
      throw new ArrayIndexOutOfBoundsException(
          "Message.checkBounds: bad offset (" + offset + ") or length ("
              + length + "), for data_length " + data_length + " in class "
              + this.getClass());
  }

  // Check that value is valid for a bitfield of length length
  private void checkValue(int length, long value) {
    if (length != 64 && (value < 0 || value >= 1L << length))
      throw new IllegalArgumentException("Message.checkValue: bad length ("
          + length + " or value (" + value + ")");
  }

  // Unsigned byte read
  private int ubyte(int offset) {
    int val = data[base_offset + offset];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
6080亚洲精品一区二区| 伊人夜夜躁av伊人久久| 国产精品白丝在线| 天天影视网天天综合色在线播放| 卡一卡二国产精品| 欧美综合久久久| 国产欧美日韩精品在线| 视频一区视频二区在线观看| www.欧美日韩国产在线| 久久久久久久久99精品| 亚洲高清不卡在线| 91免费在线看| 欧美韩日一区二区三区| 麻豆精品视频在线观看| 欧美综合久久久| 自拍偷拍国产精品| 风间由美一区二区三区在线观看 | 欧美videofree性高清杂交| 最新成人av在线| 成人黄色小视频| 久久蜜桃av一区二区天堂| 日日摸夜夜添夜夜添国产精品 | 欧美性感一区二区三区| 国产欧美久久久精品影院| 久久66热re国产| 91精品国产综合久久久蜜臀图片 | 欧美午夜电影网| 日韩毛片一二三区| 99精品久久只有精品| 国产午夜精品久久| 国产精品 欧美精品| 精品99999| 韩国精品在线观看| 久久综合久久鬼色| 色av成人天堂桃色av| 欧美激情一区二区三区四区 | 懂色av噜噜一区二区三区av| 日韩欧美国产精品| 看国产成人h片视频| 日韩三级免费观看| 激情综合色播五月| 久久亚洲一级片| 粉嫩av亚洲一区二区图片| 一区二区成人在线观看| av在线一区二区| 综合色天天鬼久久鬼色| 一本色道久久综合狠狠躁的推荐 | 中文字幕日韩精品一区| av一区二区三区黑人| 亚洲男同性恋视频| 在线不卡欧美精品一区二区三区| 天天综合网 天天综合色| 日韩精品中文字幕一区二区三区 | 91丨porny丨户外露出| 欧美国产欧美综合| 91猫先生在线| 日日夜夜精品视频天天综合网| 91精品国产日韩91久久久久久| 麻豆91精品视频| 中文成人av在线| 欧美中文字幕一二三区视频| 蜜桃av一区二区| 国产精品午夜久久| 欧美日韩免费在线视频| 国产精品69久久久久水密桃| 中文字幕欧美一| 欧美高清dvd| 国产成人a级片| 天堂久久一区二区三区| 国产亚洲精品免费| 欧美色窝79yyyycom| 国产美女精品在线| 亚洲丶国产丶欧美一区二区三区| 日韩久久久久久| 色噜噜狠狠一区二区三区果冻| 蜜臀精品一区二区三区在线观看| 国产精品久久久久精k8| 91精品国产入口| 色呦呦国产精品| 国产乱妇无码大片在线观看| 亚洲午夜三级在线| 中文久久乱码一区二区| 欧美一区二区大片| 91久久精品一区二区三| 国产乱一区二区| 日韩avvvv在线播放| 亚洲品质自拍视频网站| 久久久五月婷婷| 欧美日韩国产三级| 91啪在线观看| 东方aⅴ免费观看久久av| 日本欧美肥老太交大片| 亚洲精品国产一区二区精华液| 国产亚洲综合色| 精品国产免费一区二区三区四区| 色狠狠色噜噜噜综合网| 不卡电影免费在线播放一区| 久久99精品久久只有精品| 亚洲国产一二三| 一级日本不卡的影视| 国产精品久久久久久久午夜片| 日韩精品一区二区三区老鸭窝| 欧美日韩在线亚洲一区蜜芽| 色综合网站在线| 99在线精品一区二区三区| 国产伦精品一区二区三区免费迷| 日韩影视精彩在线| 午夜亚洲福利老司机| 中文字幕一区二区三区四区不卡 | 欧美一级搡bbbb搡bbbb| 欧美日韩一级黄| 在线视频一区二区免费| 色欲综合视频天天天| 91成人网在线| 在线观看视频91| 欧美中文字幕不卡| 在线视频一区二区三| 欧美亚洲免费在线一区| 欧美中文字幕一区二区三区亚洲| 欧美亚洲丝袜传媒另类| 国产欧美日韩另类视频免费观看| 欧美精品一区二区三| 国产成人综合亚洲91猫咪| 亚洲一区二区三区四区在线| 亚洲同性gay激情无套| 成人免费视频在线观看| 亚洲欧美综合网| 亚洲综合视频在线观看| 午夜精品123| 久久成人免费电影| 国产成人av福利| 91尤物视频在线观看| 在线免费观看日本一区| 69堂精品视频| 久久精品欧美一区二区三区不卡| 日本一区二区视频在线| 亚洲日本护士毛茸茸| 午夜视频在线观看一区二区| 久久精品99久久久| 国产成人日日夜夜| 在线影院国内精品| 日韩欧美精品在线| 国产精品对白交换视频| 亚洲国产日日夜夜| 国产乱子伦视频一区二区三区 | 亚洲精品日韩一| 日本中文一区二区三区| 国产在线国偷精品产拍免费yy| 99久久精品国产毛片| 欧美理论片在线| 中文字幕免费不卡| 三级亚洲高清视频| 成人app软件下载大全免费| 欧美视频中文一区二区三区在线观看| 欧美一级xxx| 亚洲欧洲精品一区二区三区不卡| 丝袜亚洲另类欧美| www.欧美日韩国产在线| 日韩一级黄色片| 亚洲三级小视频| 激情丁香综合五月| 欧美在线观看一二区| 久久影音资源网| 亚洲成人激情av| 99视频在线观看一区三区| 日韩精品一区二| 亚洲一二三级电影| 99久久精品国产网站| 欧美va亚洲va| 天天影视网天天综合色在线播放| 福利一区二区在线观看| 日韩久久久久久| 五月婷婷久久综合| 色狠狠一区二区| 一色屋精品亚洲香蕉网站| 蜜桃视频一区二区三区在线观看 | 成人app网站| 久久综合九色综合97婷婷女人 | 亚洲日本一区二区三区| 韩国欧美国产一区| 在线成人小视频| 亚洲一区二区三区爽爽爽爽爽| av电影在线不卡| 久久精品一区四区| 国内外成人在线| 欧美一级高清大全免费观看| 国产精品亲子伦对白| 国产真实乱对白精彩久久| 制服丝袜亚洲播放| 午夜精品福利在线| 欧美色图在线观看| 亚洲成a人v欧美综合天堂 | caoporn国产一区二区| 国产午夜亚洲精品理论片色戒| 久久精品久久久精品美女| 欧美日本在线一区| 天天爽夜夜爽夜夜爽精品视频| 欧美少妇bbb| 日韩黄色免费电影| 在线不卡中文字幕|