All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.com.ibm.as400.util.commtrace.Data Maven / Gradle / Ivy

There is a newer version: 20.0.7
Show newest version
///////////////////////////////////////////////////////////////////////////////
//                                                                             
// JTOpen (IBM Toolbox for Java - OSS version)                                 
//                                                                             
// Filename: Data.java
//                                                                             
// The source code contained herein is licensed under the IBM Public License   
// Version 1.0, which has been approved by the Open Source Initiative.         
// Copyright (C) 2002 International Business Machines Corporation and     
// others. All rights reserved.                                                
//                                                                             
///////////////////////////////////////////////////////////////////////////////

package com.ibm.as400.util.commtrace;

/**
 * Represents the data that is contained in the packet.
*/ public class Data { private BitBuf data; private final static String DATA = "Data"; /** * Initializes the data. * @param data the raw packet of data. */ Data(BitBuf data) { this.data = data; } /** * Creates a hexadecimal and Ascii representation of this data. One line is 32 characters ASCII and 64 bytes hexadecimal plus formatting characters in length. * @return String containing a printable representation of the data. */ public String toString() { if(data.getByteSize()==0) { // If there is no data return return ""; } StringBuffer fmtdata = new StringBuffer(data.getByteSize()*3); // The return data StringBuffer hexdata = new StringBuffer(32); // The output hexadecimal data StringBuffer chardata= new StringBuffer(32); // The output character representation boolean first = true; // Set to true until the first line of data is printed. int length = data.getByteSize(), i; fmtdata.append("\t" + DATA + " . . . . . . : "); for(i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy