1 /* 2 * Conditions Of Use 3 * 4 * This software was developed by employees of the National Institute of 5 * Standards and Technology (NIST), an agency of the Federal Government. 6 * Pursuant to title 15 Untied States Code Section 105, works of NIST 7 * employees are not subject to copyright protection in the United States 8 * and are considered to be in the public domain. As a result, a formal 9 * license is not needed to use the software. 10 * 11 * This software is provided by NIST as a service and is expressly 12 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 15 * AND DATA ACCURACY. NIST does not warrant or make any representations 16 * regarding the use of the software or the results thereof, including but 17 * not limited to the correctness, accuracy, reliability or usefulness of 18 * the software. 19 * 20 * Permission to use this software is contingent upon your acceptance 21 * of the terms of this agreement. 22 * 23 */ 24 /******************************************************************************* 25 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * 26 *******************************************************************************/ 27 package gov.nist.javax.sip.header; 28 29 /** 30 * Internal utility class for pretty printing and header formatting. 31 * 32 * @author M. Ranganathan 33 * @author O. Deruelle 34 * 35 * @version 1.2 $Revision: 1.6 $ $Date: 2009/07/17 18:57:31 $ 36 */ 37 class Indentation { 38 39 private int indentation; 40 41 /** 42 * Default constructor 43 */ Indentation()44 protected Indentation() { 45 indentation = 0; 46 } 47 48 /** 49 * Constructor 50 * 51 * @param initval 52 * int to set 53 */ Indentation(int initval)54 protected Indentation(int initval) { 55 indentation = initval; 56 } 57 58 /** 59 * set the indentation field 60 * 61 * @param initval 62 * int to set 63 */ setIndentation(int initval)64 protected void setIndentation(int initval) { 65 indentation = initval; 66 } 67 68 /** 69 * get the number of indentation. 70 * 71 * @return int 72 */ getCount()73 protected int getCount() { 74 return indentation; 75 } 76 77 /** 78 * increment the indentation field 79 */ increment()80 protected void increment() { 81 indentation++; 82 } 83 84 /** 85 * decrement the indentation field 86 */ decrement()87 protected void decrement() { 88 indentation--; 89 } 90 91 /** 92 * get the indentation 93 * 94 * @return String 95 */ getIndentation()96 protected String getIndentation() { 97 char[] chars = new char[indentation]; 98 java.util.Arrays.fill(chars, ' '); 99 return new String(chars); 100 } 101 102 } 103 104