/*

 * Licensed to the Apache Software Foundation (ASF) under one

 * or more contributor license agreements.  See the NOTICE file

 * distributed with this work for additional information

 * regarding copyright ownership.  The ASF licenses this file

 * to you under the Apache License, Version 2.0 (the

 * "License"); you may not use this file except in compliance

 * with the License.  You may obtain a copy of the License at

 *

 *     http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 */



// ----------------------------------------------------------------

// Hbase.thrift

//

// This is a Thrift interface definition file for the Hbase service.

// Target language libraries for C++, Java, Ruby, PHP, (and more) are

// generated by running this file through the Thrift compiler with the

// appropriate flags. The Thrift compiler binary and runtime

// libraries for various languages are available

// from the Apache Incubator (http://incubator.apache.org/thrift/)

//

// See the package.html file for information on the version of Thrift

// used to generate the *.java files checked into the Hbase project.

// ----------------------------------------------------------------



namespace java org.apache.hadoop.hbase.thrift.generated

namespace cpp  apache.hadoop.hbase.thrift

namespace rb Apache.Hadoop.Hbase.Thrift

namespace py hbase

namespace perl Hbase

namespace php Hbase

//

// Types

//



// NOTE: all variables with the Text type are assumed to be correctly

// formatted UTF-8 strings.  This is a programming language and locale

// dependent property that the client application is repsonsible for

// maintaining.  If strings with an invalid encoding are sent, an

// IOError will be thrown.



typedef binary Text

typedef binary Bytes

typedef i32    ScannerID



/**

 * TCell - Used to transport a cell value (byte[]) and the timestamp it was

 * stored with together as a result for get and getRow methods. This promotes

 * the timestamp of a cell to a first-class value, making it easy to take

 * note of temporal data. Cell is used all the way from HStore up to HTable.

 */

struct TCell{

  1:Bytes value,

  2:i64 timestamp

}



/**

 * An HColumnDescriptor contains information about a column family

 * such as the number of versions, compression settings, etc. It is

 * used as input when creating a table or adding a column.

 */

struct ColumnDescriptor {

  1:Text name,

  2:i32 maxVersions = 3,

  3:string compression = "NONE",

  4:bool inMemory = 0,

  5:string bloomFilterType = "NONE",

  6:i32 bloomFilterVectorSize = 0,

  7:i32 bloomFilterNbHashes = 0,

  8:bool blockCacheEnabled = 0,

  9:i32 timeToLive = -1

}



/**

 * A TRegionInfo contains information about an HTable region.

 */

struct TRegionInfo {

  1:Text startKey,

  2:Text endKey,

  3:i64 id,

  4:Text name,

  5:byte version,

  6:Text serverName,

  7:i32 port

}



/**

 * A Mutation object is used to either update or delete a column-value.

 */

struct Mutation {

  1:bool isDelete = 0,

  2:Text column,

  3:Text value,

  4:bool writeToWAL = 1

}





/**

 * A BatchMutation object is used to apply a number of Mutations to a single row.

 */

struct BatchMutation {

  1:Text row,

  2:list<Mutation> mutations

}



/**

 * For increments that are not incrementColumnValue

 * equivalents.

 */

struct TIncrement {

  1:Text table,

  2:Text row,

  3:Text column,

  4:i64  ammount

}



/**

 * Holds column name and the cell.

 */

struct TColumn {

  1:Text columnName,

  2:TCell cell

 }



/**

 * Holds row name and then a map of columns to cells.

 */

struct TRowResult {

  1:Text row,

  2:optional map<Text, TCell> columns,

  3:optional list<TColumn> sortedColumns

}



/**

 * A Scan object is used to specify scanner parameters when opening a scanner.

 */

struct TScan {

  1:optional Text startRow,

  2:optional Text stopRow,

  3:optional i64 timestamp,

  4:optional list<Text> columns,

  5:optional i32 caching,

  6:optional Text filterString,

  7:optional i32 batchSize,

  8:optional bool sortColumns

}



//

// Exceptions

//

/**

 * An IOError exception signals that an error occurred communicating

 * to the Hbase master or an Hbase region server.  Also used to return

 * more general Hbase error conditions.

 */

exception IOError {

  1:string message

}



/**

 * An IllegalArgument exception indicates an illegal or invalid

 * argument was passed into a procedure.

 */

exception IllegalArgument {

  1:string message

}



/**

 * An AlreadyExists exceptions signals that a table with the specified

 * name already exists

 */

exception AlreadyExists {

  1:string message

}



//

// Service

//



service Hbase {

  /**

   * Brings a table on-line (enables it)

   */

  void enableTable(

    /** name of the table */

    1:Bytes tableName

  ) throws (1:IOError io)

    

  /**

   * Disables a table (takes it off-line) If it is being served, the master

   * will tell the servers to stop serving it.

   */

  void disableTable(

    /** name of the table */

    1:Bytes tableName

  ) throws (1:IOError io)



  /**

   * @return true if table is on-line

   */

  bool isTableEnabled(

    /** name of the table to check */

    1:Bytes tableName

  ) throws (1:IOError io)

    

  void compact(1:Bytes tableNameOrRegionName)

    throws (1:IOError io)

 

  void majorCompact(1:Bytes tableNameOrRegionName)

    throws (1:IOError io)

    

  /**

   * List all the userspace tables.

   *

   * @return returns a list of names

   */

  list<Text> getTableNames()

    throws (1:IOError io)



  /**

   * List all the column families assoicated with a table.

   *

   * @return list of column family descriptors

   */

  map<Text,ColumnDescriptor> getColumnDescriptors (

    /** table name */

    1:Text tableName

  ) throws (1:IOError io)



  /**

   * List the regions associated with a table.

   *

   * @return list of region descriptors

   */

  list<TRegionInfo> getTableRegions(

    /** table name */

    1:Text tableName)

    throws (1:IOError io)



  /**

   * Create a table with the specified column families.  The name

   * field for each ColumnDescriptor must be set and must end in a

   * colon (:). All other fields are optional and will get default

   * values if not explicitly specified.

   *

   * @throws IllegalArgument if an input parameter is invalid

   *

   * @throws AlreadyExists if the table name already exists

   */

  void createTable(

    /** name of table to create */

    1:Text tableName,



    /** list of column family descriptors */

    2:list<ColumnDescriptor> columnFamilies

  ) throws (1:IOError io, 2:IllegalArgument ia, 3:AlreadyExists exist)



  /**

   * Deletes a table

   *

   * @throws IOError if table doesn't exist on server or there was some other

   * problem

   */

  void deleteTable(

    /** name of table to delete */

    1:Text tableName

  ) throws (1:IOError io)



  /**

   * Get a single TCell for the specified table, row, and column at the

   * latest timestamp. Returns an empty list if no such value exists.

   *

   * @return value for specified row/column

   */

  list<TCell> get(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** column name */

    3:Text column,



    /** Get attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get the specified number of versions for the specified table,

   * row, and column.

   *

   * @return list of cells for specified row/column

   */

  list<TCell> getVer(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** column name */

    3:Text column,



    /** number of versions to retrieve */

    4:i32 numVersions,



    /** Get attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get the specified number of versions for the specified table,

   * row, and column.  Only versions less than or equal to the specified

   * timestamp will be returned.

   *

   * @return list of cells for specified row/column

   */

  list<TCell> getVerTs(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** column name */

    3:Text column,



    /** timestamp */

    4:i64 timestamp,



    /** number of versions to retrieve */

    5:i32 numVersions,



    /** Get attributes */

    6:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get all the data for the specified table and row at the latest

   * timestamp. Returns an empty list if the row does not exist.

   *

   * @return TRowResult containing the row and map of columns to TCells

   */

  list<TRowResult> getRow(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** Get attributes */

    3:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get the specified columns for the specified table and row at the latest

   * timestamp. Returns an empty list if the row does not exist.

   *

   * @return TRowResult containing the row and map of columns to TCells

   */

  list<TRowResult> getRowWithColumns(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** List of columns to return, null for all columns */

    3:list<Text> columns,



    /** Get attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get all the data for the specified table and row at the specified

   * timestamp. Returns an empty list if the row does not exist.

   *

   * @return TRowResult containing the row and map of columns to TCells

   */

  list<TRowResult> getRowTs(

    /** name of the table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** timestamp */

    3:i64 timestamp,



    /** Get attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)

    

  /**

   * Get the specified columns for the specified table and row at the specified

   * timestamp. Returns an empty list if the row does not exist.

   *

   * @return TRowResult containing the row and map of columns to TCells

   */

  list<TRowResult> getRowWithColumnsTs(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** List of columns to return, null for all columns */

    3:list<Text> columns,

    4:i64 timestamp,



    /** Get attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get all the data for the specified table and rows at the latest

   * timestamp. Returns an empty list if no rows exist.

   *

   * @return TRowResult containing the rows and map of columns to TCells

   */

  list<TRowResult> getRows(

    /** name of table */

    1:Text tableName,



    /** row keys */

    2:list<Text> rows



    /** Get attributes */

    3:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get the specified columns for the specified table and rows at the latest

   * timestamp. Returns an empty list if no rows exist.

   *

   * @return TRowResult containing the rows and map of columns to TCells

   */

  list<TRowResult> getRowsWithColumns(

    /** name of table */

    1:Text tableName,



    /** row keys */

    2:list<Text> rows,



    /** List of columns to return, null for all columns */

    3:list<Text> columns,



    /** Get attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get all the data for the specified table and rows at the specified

   * timestamp. Returns an empty list if no rows exist.

   *

   * @return TRowResult containing the rows and map of columns to TCells

   */

  list<TRowResult> getRowsTs(

    /** name of the table */

    1:Text tableName,



    /** row keys */

    2:list<Text> rows



    /** timestamp */

    3:i64 timestamp,



    /** Get attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get the specified columns for the specified table and rows at the specified

   * timestamp. Returns an empty list if no rows exist.

   *

   * @return TRowResult containing the rows and map of columns to TCells

   */

  list<TRowResult> getRowsWithColumnsTs(

    /** name of table */

    1:Text tableName,



    /** row keys */

    2:list<Text> rows



    /** List of columns to return, null for all columns */

    3:list<Text> columns,

    4:i64 timestamp,



    /** Get attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Apply a series of mutations (updates/deletes) to a row in a

   * single transaction.  If an exception is thrown, then the

   * transaction is aborted.  Default current timestamp is used, and

   * all entries will have an identical timestamp.

   */

  void mutateRow(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** list of mutation commands */

    3:list<Mutation> mutations,



    /** Mutation attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Apply a series of mutations (updates/deletes) to a row in a

   * single transaction.  If an exception is thrown, then the

   * transaction is aborted.  The specified timestamp is used, and

   * all entries will have an identical timestamp.

   */

  void mutateRowTs(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** list of mutation commands */

    3:list<Mutation> mutations,



    /** timestamp */

    4:i64 timestamp,



    /** Mutation attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Apply a series of batches (each a series of mutations on a single row)

   * in a single transaction.  If an exception is thrown, then the

   * transaction is aborted.  Default current timestamp is used, and

   * all entries will have an identical timestamp.

   */

  void mutateRows(

    /** name of table */

    1:Text tableName,



    /** list of row batches */

    2:list<BatchMutation> rowBatches,



    /** Mutation attributes */

    3:map<Text, Text> attributes

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Apply a series of batches (each a series of mutations on a single row)

   * in a single transaction.  If an exception is thrown, then the

   * transaction is aborted.  The specified timestamp is used, and

   * all entries will have an identical timestamp.

   */

  void mutateRowsTs(

    /** name of table */

    1:Text tableName,



    /** list of row batches */

    2:list<BatchMutation> rowBatches,



    /** timestamp */

    3:i64 timestamp,



    /** Mutation attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Atomically increment the column value specified.  Returns the next value post increment.

   */

  i64 atomicIncrement(

    /** name of table */

    1:Text tableName,



    /** row to increment */

    2:Text row,



    /** name of column */

    3:Text column,



    /** amount to increment by */

    4:i64 value

  ) throws (1:IOError io, 2:IllegalArgument ia)

    

  /**

   * Delete all cells that match the passed row and column.

   */

  void deleteAll(

    /** name of table */

    1:Text tableName,



    /** Row to update */

    2:Text row,



    /** name of column whose value is to be deleted */

    3:Text column,



    /** Delete attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Delete all cells that match the passed row and column and whose

   * timestamp is equal-to or older than the passed timestamp.

   */

  void deleteAllTs(

    /** name of table */

    1:Text tableName,



    /** Row to update */

    2:Text row,



    /** name of column whose value is to be deleted */

    3:Text column,



    /** timestamp */

    4:i64 timestamp,



    /** Delete attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Completely delete the row's cells.

   */

  void deleteAllRow(

    /** name of table */

    1:Text tableName,



    /** key of the row to be completely deleted. */

    2:Text row,



    /** Delete attributes */

    3:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Increment a cell by the ammount.

   * Increments can be applied async if hbase.regionserver.thrift.coalesceIncrement is set to true.

   * False is the default.  Turn to true if you need the extra performance and can accept some

   * data loss if a thrift server dies with increments still in the queue.

   */

  void increment(

    /** The single increment to apply */

    1:TIncrement increment

  ) throws (1:IOError io)





  void incrementRows(

    /** The list of increments */

    1:list<TIncrement> increments

  ) throws (1:IOError io)



  /**

   * Completely delete the row's cells marked with a timestamp

   * equal-to or older than the passed timestamp.

   */

  void deleteAllRowTs(

    /** name of table */

    1:Text tableName,



    /** key of the row to be completely deleted. */

    2:Text row,



    /** timestamp */

    3:i64 timestamp,



    /** Delete attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get a scanner on the current table, using the Scan instance

   * for the scan parameters.

   */

  ScannerID scannerOpenWithScan(

    /** name of table */

    1:Text tableName,



    /** Scan instance */

    2:TScan scan,



    /** Scan attributes */

    3:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get a scanner on the current table starting at the specified row and

   * ending at the last row in the table.  Return the specified columns.

   *

   * @return scanner id to be used with other scanner procedures

   */

  ScannerID scannerOpen(

    /** name of table */

    1:Text tableName,



    /**

     * Starting row in table to scan.

     * Send "" (empty string) to start at the first row.

     */

    2:Text startRow,



    /**

     * columns to scan. If column name is a column family, all

     * columns of the specified column family are returned. It's also possible

     * to pass a regex in the column qualifier.

     */

    3:list<Text> columns,



    /** Scan attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get a scanner on the current table starting and stopping at the

   * specified rows.  ending at the last row in the table.  Return the

   * specified columns.

   *

   * @return scanner id to be used with other scanner procedures

   */

  ScannerID scannerOpenWithStop(

    /** name of table */

    1:Text tableName,



    /**

     * Starting row in table to scan.

     * Send "" (empty string) to start at the first row.

     */

    2:Text startRow,



    /**

     * row to stop scanning on. This row is *not* included in the

     * scanner's results

     */

    3:Text stopRow,



    /**

     * columns to scan. If column name is a column family, all

     * columns of the specified column family are returned. It's also possible

     * to pass a regex in the column qualifier.

     */

    4:list<Text> columns,



    /** Scan attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Open a scanner for a given prefix.  That is all rows will have the specified

   * prefix. No other rows will be returned.

   *

   * @return scanner id to use with other scanner calls

   */

  ScannerID scannerOpenWithPrefix(

    /** name of table */

    1:Text tableName,



    /** the prefix (and thus start row) of the keys you want */

    2:Text startAndPrefix,



    /** the columns you want returned */

    3:list<Text> columns,



    /** Scan attributes */

    4:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get a scanner on the current table starting at the specified row and

   * ending at the last row in the table.  Return the specified columns.

   * Only values with the specified timestamp are returned.

   *

   * @return scanner id to be used with other scanner procedures

   */

  ScannerID scannerOpenTs(

    /** name of table */

    1:Text tableName,



    /**

     * Starting row in table to scan.

     * Send "" (empty string) to start at the first row.

     */

    2:Text startRow,



    /**

     * columns to scan. If column name is a column family, all

     * columns of the specified column family are returned. It's also possible

     * to pass a regex in the column qualifier.

     */

    3:list<Text> columns,



    /** timestamp */

    4:i64 timestamp,



    /** Scan attributes */

    5:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Get a scanner on the current table starting and stopping at the

   * specified rows.  ending at the last row in the table.  Return the

   * specified columns.  Only values with the specified timestamp are

   * returned.

   *

   * @return scanner id to be used with other scanner procedures

   */

  ScannerID scannerOpenWithStopTs(

    /** name of table */

    1:Text tableName,



    /**

     * Starting row in table to scan.

     * Send "" (empty string) to start at the first row.

     */

    2:Text startRow,



    /**

     * row to stop scanning on. This row is *not* included in the

     * scanner's results

     */

    3:Text stopRow,



    /**

     * columns to scan. If column name is a column family, all

     * columns of the specified column family are returned. It's also possible

     * to pass a regex in the column qualifier.

     */

    4:list<Text> columns,



    /** timestamp */

    5:i64 timestamp,



    /** Scan attributes */

    6:map<Text, Text> attributes

  ) throws (1:IOError io)



  /**

   * Returns the scanner's current row value and advances to the next

   * row in the table.  When there are no more rows in the table, or a key

   * greater-than-or-equal-to the scanner's specified stopRow is reached,

   * an empty list is returned.

   *

   * @return a TRowResult containing the current row and a map of the columns to TCells.

   *

   * @throws IllegalArgument if ScannerID is invalid

   *

   * @throws NotFound when the scanner reaches the end

   */

  list<TRowResult> scannerGet(

    /** id of a scanner returned by scannerOpen */

    1:ScannerID id

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Returns, starting at the scanner's current row value nbRows worth of

   * rows and advances to the next row in the table.  When there are no more

   * rows in the table, or a key greater-than-or-equal-to the scanner's

   * specified stopRow is reached,  an empty list is returned.

   *

   * @return a TRowResult containing the current row and a map of the columns to TCells.

   *

   * @throws IllegalArgument if ScannerID is invalid

   *

   * @throws NotFound when the scanner reaches the end

   */

  list<TRowResult> scannerGetList(

    /** id of a scanner returned by scannerOpen */

    1:ScannerID id,



    /** number of results to return */

    2:i32 nbRows

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Closes the server-state associated with an open scanner.

   *

   * @throws IllegalArgument if ScannerID is invalid

   */

  void scannerClose(

    /** id of a scanner returned by scannerOpen */

    1:ScannerID id

  ) throws (1:IOError io, 2:IllegalArgument ia)



  /**

   * Get the row just before the specified one.

   *

   * @return value for specified row/column

   */

  list<TCell> getRowOrBefore(

    /** name of table */

    1:Text tableName,



    /** row key */

    2:Text row,



    /** column name */

    3:Text family

  ) throws (1:IOError io)



  /**

   * Get the regininfo for the specified row. It scans

   * the metatable to find region's start and end keys.

   *

   * @return value for specified row/column

   */

  TRegionInfo getRegionInfo(

    /** row key */

    1:Text row,



  ) throws (1:IOError io)

}

hbase thrift 定义的更多相关文章

  1. HBase & thrift & C++编程

    目录 目录 1 1. 前言 1 2. 启动和停止thrift2 1 2.1. 启动thrift2 1 2.2. 停止thrift2 1 2.3. 启动参数 2 3. hbase.thrift 2 3. ...

  2. python Hbase Thrift pycharm 及引入包

    cp -r hbase/ /usr/lib/python2.7/site-packages/ 官方示例子http://code.google.com/p/hbase-thrift/source/bro ...

  3. HBase Thrift过滤语法

    摘抄自hbase ref guide 0.94: 在写本文的时候,hbase ref guide已经更新到1.2及2.0了,但是个人感觉Thrift过滤语法部分写得都没有0.94的好,省掉了examp ...

  4. hbase thrift 访问队列

    public class CallQueue implements BlockingQueue<Runnable> {   private static Log LOG = LogFact ...

  5. 搭建HBase+thrift+php环境

    http://www.beauty-soft.net/blog/ceiba/hadoop/2013-05-19/644.html http://www.360doc.com/content/11/07 ...

  6. 通过Thrift实现C#与Hbase交流

    近期着手的一个项目需要将我方数据存储到Hadoop的大数据环境,由于本人是.net平台的开发者,没有怎么接触过大数据(因为他实在是太高大尚了).但还好baidu, google后,还是很找到了解决办法 ...

  7. 使用C#通过Thrift访问HBase

    前言 因为项目需要要为客户程序提供C#.Net的HBase访问接口,而HBase并没有提供原生的.Net客户端接口,可以通过启动HBase的Thrift服务来提供多语言支持. Thrift介绍 环境 ...

  8. 在Azure HDInsight HBase集群中使用Thrift接口

    Sun wei  Wed, Feb 25 2015 2:17 AM Apache Thrift 是一种可扩展的跨语言服务接口,可以通过内置的代码生成引擎帮助创建跨语言服务类库,Apache HBase ...

  9. PHP通过Thrift操作Hbase

    PHP通过Thrift操作Hbase     HBase是一个开源的NoSQL产品,它是实现了Google BigTable论文的一个开源产品,和Hadoop和HDFS一起,可用来存储和处理海量col ...

随机推荐

  1. EBS业务学习之应收管理

    Oracle Receivable 是功能完备地应收款管理系统,它能够有效地管理客户.发票和收帐过程,因此是财务模块的重要组成部分,是财务系统中较为核心的模块之一.对于一个公司来说,是否能够与客户保持 ...

  2. Swift中switch强大的模式匹配

    不少人觉得Swift中switch语句和C或C++,乃至ObjC中的差不多,此言大谬! 让本猫带领大家看一下Swift中switch语句模式匹配的威力. 所谓模式匹配就是利用一定模式(比如couple ...

  3. Android动态换肤(一、应用内置多套皮肤)

    动态换肤在很多android应用中都有使用,用户根据自己的喜好设置皮肤主题,可以增强用户使用应用的舒适度. Android换肤可以分为很多种,它们从使用方式,用户体验以及项目框架设计上体现了明显的差异 ...

  4. Android中PropertyAnimation属性动画详解(一)

    在之前的文章中已经讲了帧动画frame-by-frame animation和补间动画tweened animation,其实这两种动画原理好简单,都是按照预先固定的动画模式来播放的,帧动画将一张张单 ...

  5. 操作系统处理内存时内存页为4k

    windows和unix处理内存时,一个内存页的大小都为4k. 测试代码 int main() { while (1) { int *p = (int *)malloc(1024); getchar( ...

  6. 修改android应用包名

    由于项目需要,要修改已经开发好的应用包名,这本身很简单,但是如果你没找到门道,可能会白白浪费许多时间. 修改包名有三个地方要改,这三个地方的修改一定要按顺序来,否则你可能会遇到许多不必要的麻烦. 1. ...

  7. shell编程——if语句

    if 语句格式 if  条件 then  Command else  Command fi                              别忘了这个结尾 If语句忘了结尾fi test.s ...

  8. Collections类解析

    最常用的排序: 需要实现Comparable接口 1.什么是Comparable接口 此接口强行对实现它的每个类的对象进行整体排序.此排序被称为该类的自然排序 ,类的 compareTo 方法被称为它 ...

  9. android分包方案

    当一个app的功能越来越复杂,代码量越来越多,也许有一天便会突然遇到下列现象: 1. 生成的apk在2.3以前的机器无法安装,提示INSTALL_FAILED_DEXOPT 2. 方法数量过多,编译时 ...

  10. Zeroc Ice原理介绍

    Ice介绍         Ice(Internet Communications Engine)是ZeroC公司的杰作,继承了CORBA的血统,是新一代的面向对象的分布式系统中间件.Ice是RPC通 ...