home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 5.1 KB | 205 lines |
- /*
- * Copyright (c) 1997 Krumel & Associates, Inc. All Rights Reserved.
- *
- * www.krumel.com - controls@krumel.com
- *
- * Permission is given to the buyer of this package for one software
- * developer to use this software on one CPU (one workstation) and to make
- * one backup copy. You may uitilize and/or modify this class for use in your
- * projects. You may distribute or sell any executable which results from
- * using this code in yur application, except a utility or class of similar
- * nature to this product. You may distribute this product in compiled
- * form only, but soley to be used with your cmpiled executable product
- * for the puposes of dynamic loading. You may NOT redistribute the source
- * code in any form or make it accessible through a network or other
- * distribution media to others. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * The source code is the confidential and proprietary information
- * of Krumel & Associates, Inc. ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Krumel & Associates, Inc..
-
- * KRUMEL & ASSOCIATES MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
- * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KRUMEL & ASSOCIATES SHALL NOT
- * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
- * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
-
- package symantec.itools.db.awt.genutil;
-
- import java.io.*;
-
- public class Out {
- public static String sep = ", ";
- PrintStream ps;
-
- public static final Out std = new Out(System.out);
- public static final Out err = new Out(System.err);
-
- public Out(PrintStream p) {
- ps = p;
- }
-
- public Out println() {
- ps.println();
- return this;
- }
-
- public Out print(String s) {
- ps.print(s);
- return this;
- }
-
- public Out print(Object o) {
- ps.print(o);
- return this;
- }
-
- public Out println(Object o) {
- ps.println(o);
- return this;
- }
-
- public Out print(String s, int w) {
- ps.print(s);
- space(s.length() - w);
- return this;
- }
-
- public Out println(String s) {
- ps.println(s);
- return this;
- }
-
- public Out print(char c) {
- print(c);
- return this;
- }
-
- public Out println(char c) {
- ps.println(c);
- return this;
- }
-
- public Out print(long l) {
- ps.print(l);
- return this;
- }
-
- public Out println(long l) {
- ps.println(l);
- return this;
- }
-
- public Out print(long l, int w) {
- String s = String.valueOf(l);
- return print(s, w);
- }
-
- public Out print(double d) {
- ps.print(d);
- return this;
- }
-
- public Out println(double d) {
- ps.println(d);
- return this;
- }
-
- public Out print(boolean b) {
- ps.print(b);
- return this;
- }
-
- public Out print(boolean b, int w) {
- String s = String.valueOf(b);
- return print(s, w);
- }
-
- public Out sep() {
- ps.print(sep);
- return this;
- }
-
- public Out space(int i) {
- if (i <= 0) { return this; }
-
- while(i-->0) {
- ps.print(' ');
- }
-
- return this;
- }
-
- //static versions
- public static Out print(PrintStream ps, String s) {
- ps.print(s);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, String s, int w) {
- ps.print(s);
- space(ps, s.length() - w);
- return new Out(ps);
- }
-
- public static Out println(PrintStream ps, String s) {
- ps.print(s);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, char c) {
- ps.print(c);
- return new Out(ps);
- }
-
- public static Out println(PrintStream ps, char c) {
- ps.println(c);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, long l) {
- ps.print(l);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, long l, int w) {
- String s = String.valueOf(l);
-
- return print(ps, s, w);
- }
-
- public static Out print(PrintStream ps, double d) {
- ps.print(d);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, boolean b) {
- ps.print(b);
- return new Out(ps);
- }
-
- public static Out print(PrintStream ps, boolean b, int w) {
- String s = String.valueOf(b);
- return print(ps, s, w);
- }
-
- public static Out sep(PrintStream ps) {
- ps.print(sep);
- return new Out(ps);
- }
-
- public static Out space(PrintStream ps, int i) {
- if (i <= 0) { return std; }
-
- while(i-->0) {
- ps.print(' ');
- }
-
- return new Out(ps);
- }
- }