當前位置: 首頁>>代碼示例>>Java>>正文


Java LEDataInputStream類代碼示例

本文整理匯總了Java中com.keepassdroid.stream.LEDataInputStream的典型用法代碼示例。如果您正苦於以下問題:Java LEDataInputStream類的具體用法?Java LEDataInputStream怎麽用?Java LEDataInputStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LEDataInputStream類屬於com.keepassdroid.stream包,在下文中一共展示了LEDataInputStream類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadFromFile

import com.keepassdroid.stream.LEDataInputStream; //導入依賴的package包/類
/**
 * Parse given buf, as read from file.
 * @param buf
 * @throws IOException 
 */
public void loadFromFile( byte buf[], int offset ) throws IOException {
	signature1 = LEDataInputStream.readInt( buf, offset + 0 );
	signature2 = LEDataInputStream.readInt( buf, offset + 4 );
	flags = LEDataInputStream.readInt( buf, offset + 8 );
	version = LEDataInputStream.readInt( buf, offset + 12 );

	System.arraycopy( buf, offset + 16, masterSeed, 0, 16 );
	System.arraycopy( buf, offset + 32, encryptionIV, 0, 16 );

	numGroups = LEDataInputStream.readInt( buf, offset + 48 );
	numEntries = LEDataInputStream.readInt( buf, offset + 52 );

	System.arraycopy( buf, offset + 56, contentsHash, 0, 32 );

	System.arraycopy( buf, offset + 88, transformSeed, 0, 32 );
	numKeyEncRounds = LEDataInputStream.readInt( buf, offset + 120 );
	if ( numKeyEncRounds < 0 ) {
		// TODO: Really treat this like an unsigned integer
		throw new IOException("Does not support more than " + Integer.MAX_VALUE + " rounds.");
	}
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:27,代碼來源:PwDbHeaderV3.java

示例2: readGroupField

import com.keepassdroid.stream.LEDataInputStream; //導入依賴的package包/類
/**
 * Parse and save one record from binary file.
 * @param buf
 * @param offset
 * @return If >0, 
 * @throws UnsupportedEncodingException 
 */
void readGroupField(PwDatabaseV3 db, PwGroupV3 grp, int fieldType, byte[] buf, int offset) throws UnsupportedEncodingException {
	switch( fieldType ) {
	case 0x0000 :
		// Ignore field
		break;
	case 0x0001 :
		grp.groupId = LEDataInputStream.readInt(buf, offset);
		break;
	case 0x0002 :
		grp.name = Types.readCString(buf, offset);
		break;
	case 0x0003 :
		grp.tCreation = new PwDate(buf, offset);
		break;
	case 0x0004 :
		grp.tLastMod = new PwDate(buf, offset);
		break;
	case 0x0005 :
		grp.tLastAccess = new PwDate(buf, offset);
		break;
	case 0x0006 :
		grp.tExpire = new PwDate(buf, offset);
		break;
	case 0x0007 :
		grp.icon = db.iconFactory.getIcon(LEDataInputStream.readInt(buf, offset));
		break;
	case 0x0008 :
		grp.level = LEDataInputStream.readUShort(buf, offset);
		break;
	case 0x0009 :
		grp.flags = LEDataInputStream.readInt(buf, offset);
		break;
	}
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:42,代碼來源:ImporterV3.java

示例3: readEntryField

import com.keepassdroid.stream.LEDataInputStream; //導入依賴的package包/類
void readEntryField(PwDatabaseV3 db, PwEntryV3 ent, byte[] buf, int offset)
throws UnsupportedEncodingException
{
	int fieldType = LEDataInputStream.readUShort(buf, offset);
	offset += 2;
	int fieldSize = LEDataInputStream.readInt(buf, offset);
	offset += 4;

	switch( fieldType ) {
	case 0x0000 :
		// Ignore field
		break;
	case 0x0001 :
		ent.setUUID(Types.bytestoUUID(buf, offset));
		break;
	case 0x0002 :
		ent.groupId = LEDataInputStream.readInt(buf, offset);
		break;
	case 0x0003 :
		int iconId = LEDataInputStream.readInt(buf, offset);
		
		// Clean up after bug that set icon ids to -1
		if (iconId == -1) {
			iconId = 0;
		}
		
		ent.icon = db.iconFactory.getIcon(iconId);
		break;
	case 0x0004 :
		ent.title = Types.readCString(buf, offset); 
		break;
	case 0x0005 :
		ent.url = Types.readCString(buf, offset);
		break;
	case 0x0006 :
		ent.username = Types.readCString(buf, offset);
		break;
	case 0x0007 :
		ent.setPassword(buf, offset, Types.strlen(buf, offset));
		break;
	case 0x0008 :
		ent.additional = Types.readCString(buf, offset);
		break;
	case 0x0009 :
		ent.tCreation = new PwDate(buf, offset);
		break;
	case 0x000A :
		ent.tLastMod = new PwDate(buf, offset);
		break;
	case 0x000B :
		ent.tLastAccess = new PwDate(buf, offset);
		break;
	case 0x000C :
		ent.tExpire = new PwDate(buf, offset);
		break;
	case 0x000D :
		ent.binaryDesc = Types.readCString(buf, offset);
		break;
	case 0x000E :
		ent.setBinaryData(buf, offset, fieldSize);
		break;
	}
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:64,代碼來源:ImporterV3.java


注:本文中的com.keepassdroid.stream.LEDataInputStream類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。