All pastes #829557 Raw Edit

Untitled

public text v1 · immutable
#829557 ·published 2007-12-23 07:25 UTC
rendered paste body
	public HaspInfo BuildFromBytes(HaspInfo hasp_info)
	{
				
		try
		{
			int numRead = 0;
			int size = 4;
			int offset = 0;
			byte bytes[] = new byte[size];
			hasp_info = new HaspInfo();
			boolean bSuccsess = false;
			
				
			if( (numRead = m_bArr.read(bytes, offset, size)) == 4 )
			{
				hasp_info.m_sPadding1 = new String(bytes);
				numRead = 0;
				byte bytes1[] = new byte[size];
								
				if( (numRead = m_bArr.read(bytes1, offset, size)) == 4 )
				{
					hasp_info.m_sLabel = new String(bytes1);
					numRead = 0;
					byte bytes2[] = new byte[size];
					
					if( (numRead = m_bArr.read(bytes2, offset, size)) == 4 )
					{
						 int n =  (((bytes2[1] & 0xff) << 8) | ((bytes2[0] & 0xff) ) |
								   ((bytes2[3] & 0xff) << 24) | (bytes2[2] & 0xff) << 16);
						
						hasp_info.m_sIntegratorID = Integer.toString(n);
						numRead = 0;
						size = 8;
						byte bytes3[] = new byte[size];
						if( (numRead = m_bArr.read(bytes3, offset, size)) == 8 )	
						{
							hasp_info.m_sIntegratorName = new String(bytes3); 
							numRead = 0;
							size = 1;
							byte bytes4[] = new byte[size];
							
							if( (numRead = m_bArr.read(bytes4, offset, size)) == 1 )	
							{
								short sh = (short)(bytes4[0] & 0xff);

								hasp_info.m_sType = Short.toString(sh);
								numRead = 0;
								byte bytes5[] = new byte[size];
								
								if( (numRead = m_bArr.read(bytes5, offset, size)) == 1 )	
								{
									short sh1 = (short)(bytes5[0] & 0xff);
																						
									hasp_info.m_sHaspVer = Short.toString(sh1);
									numRead = 0;
									size = 2;
									byte bytes6[] = new byte[size];
									
									if( (numRead = m_bArr.read(bytes6, offset, size)) == 2 )	
									{
										short n1 = (short)((bytes6[1] << 8)  | (bytes6[0] & 0xff));
							
										hasp_info.m_sChannels = Short.toString(n1);
										numRead = 0;
										size = 1;
										byte bytes7[] = new byte[size];
							
										if( (numRead = m_bArr.read(bytes7, offset, size)) == 1 )	
										{
											short sh2 = (short)(bytes7[0] & 0xff);		
											hasp_info.m_sCount = Short.toString(sh2);
											numRead = 0;
											size = 8;
											byte bytes8[] = new byte[size];
										
											if( (numRead = m_bArr.read(bytes8, offset, size)) == 8 )	
											{
												hasp_info.m_sDate = new String(bytes8);
												numRead = 0;
												size = 1;
												byte bytes9[] = new byte[size];
												
												if( (numRead = m_bArr.read(bytes9, offset, size)) == 1 )
												{
													short sh3 = (short)(bytes9[0] & 0xff);
													hasp_info.m_sVideoWallMonitors = Short.toString(sh3);
													size = 2;
													byte bytes10[] = new byte[size];
											
													if( (numRead = m_bArr.read(bytes10, offset, size)) == 2 )	
													{
														hasp_info.m_sPadding2 = new String(bytes10);
														numRead = 0;
														size = 4;
														byte bytes11[] = new byte[size];
											
														if( (numRead = m_bArr.read(bytes11, offset, size)) == 4 )	
														{
															int n2 =  (((bytes11[1] & 0xff) << 8) | ((bytes11[0] & 0xff) ) |
																	   ((bytes11[3] & 0xff) << 24) | (bytes11[2] & 0xff) << 16);
																				   
															hasp_info.m_sCustomerID = Integer.toString(n2);
															
															numRead = 0;
															byte bytes12[] = new byte[size];
															
															if( (numRead = m_bArr.read(bytes12, offset, size)) == 4 )	
															{
																										
																int n3 =  (((bytes12[1] & 0xff) << 8) | ((bytes12[0] & 0xff) ) |
																		   ((bytes12[3] & 0xff) << 24) | (bytes12[2] & 0xff) << 16);
																																   
																hasp_info.m_sCreatorID = Integer.toString(n3);
																numRead = 0;
																size = 8;
																byte bytes13[] = new byte[size];
																
																if( (numRead = m_bArr.read(bytes13, offset, size)) == 8 )
																{
																	hasp_info.m_sCreatorName = new String(bytes13);
																	numRead = 0;
																	size = 16;
																	byte bytes14[] = new byte[size];
																	
																	if( (numRead = m_bArr.read(bytes14, offset, size)) == 16 )
																	{
																		hasp_info.m_sCustomerName = new String(bytes14);
																		numRead = 0;
																		size = 1;
																		byte bytes15[] = new byte[size];
																		
																		if( (numRead = m_bArr.read(bytes15, offset, size)) == 1 )
																		{
																			short sh4 = (short)(bytes15[0] & 0xff);
																			hasp_info.m_sTvMuMaChannels = Short.toString(sh4);
																			numRead = 0;
																			size = 3;
																			byte bytes16[] = new byte[size];
																
																			if( (numRead = m_bArr.read(bytes16, offset, size)) == 3 )
																			{
																				hasp_info.m_sPadding3 = new String(bytes16);
																				numRead = 0;
																				size = 4;
																				byte bytes17[] = new byte[size];
															
																				if( (numRead = m_bArr.read(bytes17, offset, size)) == 4 )
																				{
																													
																					int n4 =  (((bytes17[1] & 0xff) << 8) | ((bytes17[0] & 0xff) ) |
																							   ((bytes17[3] & 0xff) << 24) | (bytes17[2] & 0xff) << 16);
																					
																					
																					hasp_info.m_sProductFlags = Integer.toString(n4);
																					numRead = 0;
																					size = 4;
																					byte bytes18[] = new byte[size];
																					
																					if( (numRead = m_bArr.read(bytes18, offset, size)) == 4 )
																					{
																																								
																						long n5 =  ((((long)bytes18[1] & 0xff) << 8) | (((long)bytes18[0] & 0xff) ) |
																								   (((long)bytes18[3] & 0xff) << 24) | ((long)bytes18[2] & 0xff) << 16);
																						
																						hasp_info.m_sAlternateId1 = Long.toString(n5);
																																											
																						size = 4;
																						byte bytes19[] = new byte[size];
																						
																						if( (numRead = m_bArr.read(bytes19, offset, size)) == 4 )
																						{
																																									
																							long n6 =  ((((long)bytes19[1] & 0xff) << 8) | (((long)bytes19[0] & 0xff) ) |
																									   (((long)bytes19[3] & 0xff) << 24) | ((long)bytes19[2] & 0xff) << 16);
																										
																							hasp_info.m_sAlternateId2 = Long.toString(n6);
																				
																					
																							size = 4;
																							byte bytes20[] = new byte[size];
																							
																							if( (numRead = m_bArr.read(bytes20, offset, size)) == 4 )
																							{
																																										
																								long n7 =  ((((long)bytes20[1] & 0xff) << 8) | (((long)bytes20[0] & 0xff) ) |
																										   (((long)bytes20[3] & 0xff) << 24) | ((long)bytes20[2] & 0xff) << 16);
																											
																								hasp_info.m_sAlternateId3 = Long.toString(n7);
																							
																					
																								size = 4;
																								byte bytes21[] = new byte[size];
																								
																								if( (numRead = m_bArr.read(bytes21, offset, size)) == 4 )
																								{
																																											
																									long n8 =  ((((long)bytes21[1] & 0xff) << 8) | (((long)bytes21[0] & 0xff) ) |
																											   (((long)bytes21[3] & 0xff) << 24) | ((long)bytes21[2] & 0xff) << 16);
																												
																									hasp_info.m_sAlternateId4 = Long.toString(n8);
																									
																									bSuccsess = true;
																								}
																							}
																						}	
																							
																					}
																					
																						/*		size = 16;
																								byte bytes18[] = new byte[size];
																				
																								if( (numRead = m_bArr.read(bytes18, offset, size)) == 16 )
																								{
																																											
																									int n5 =  (((bytes18[1] & 0xff) << 8) | ((bytes18[0] & 0xff) ) |
																											   ((bytes18[3] & 0xff) << 24) | (bytes18[2] & 0xff) << 16);
																												
																									hasp_info.m_sSecondaryIds = Integer.toString(n5);
																									bSuccsess = true;
																																																									
																								} */
																					
																				}
																				
																				
																			}
																			
																			
																			
																		}
																		
																	}
																	
																}
															}
															
														}	
														
													}
													
												}
												
											}
											
										}
										
									}
									
									
								}
								
							}
							
						}
						
					}				
				}
			    
			
			}
			if(bSuccsess == false)
				hasp_info = null;
			
		}
		catch ( Exception e )
		{
			e.printStackTrace();
			return null;
		}
		return hasp_info;
	}
	
}