com.hfg.svg.SvgDoc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.svg;
import com.hfg.xml.Doctype;
import com.hfg.xml.XMLDoc;
import com.hfg.xml.XMLException;
import com.hfg.xml.XMLTag;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
//------------------------------------------------------------------------------
/**
* Container for an SVG (Scalable Vector Graphics) document.
*
* @author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
public class SvgDoc extends XMLDoc
{
//###########################################################################
// CONSTRUCTORS
//###########################################################################
//---------------------------------------------------------------------------
public SvgDoc()
{
super();
setRootNode(new SVG());
}
//---------------------------------------------------------------------------
public SvgDoc(SVG inRootTag)
{
super(inRootTag);
// init();
}
//---------------------------------------------------------------------------
public SvgDoc(File inFile)
throws XMLException, IOException
{
super(inFile);
// init();
}
//---------------------------------------------------------------------------
public SvgDoc(BufferedInputStream inStream)
{
super(inStream);
}
//###########################################################################
// PUBLIC METHODS
//###########################################################################
//---------------------------------------------------------------------------
@Override
public SVG getRootNode()
{
return (SVG) new SVG((XMLTag)super.getRootNode());
}
//---------------------------------------------------------------------------
@Override
public SvgDoc setName(String inValue)
{
return (SvgDoc) super.setName(inValue);
}
//---------------------------------------------------------------------------
public String toSVG()
{
return toXML();
}
//---------------------------------------------------------------------------
public void toSVG(OutputStream inStream)
{
toXML(inStream);
}
//---------------------------------------------------------------------------
public void toSVG(PrintWriter inWriter)
{
toXML(inWriter);
}
//---------------------------------------------------------------------------
public void toSVG(File inFile)
{
toXML(inFile);
}
//---------------------------------------------------------------------------
public void toSVG(HttpServletResponse inResponse)
{
try
{
Writer writer = null;
try
{
writer = inResponse.getWriter();
toXML(writer);
}
finally
{
if (writer != null)
{
writer.close();
}
}
}
catch (IOException e)
{
throw new XMLException(e);
}
}
//--------------------------------------------------------------------------
public String toIndentedSVG(int inInitialIndentLevel, int inIndentSize)
{
return toIndentedXML(inInitialIndentLevel, inIndentSize);
}
//--------------------------------------------------------------------------
public void toIndentedSVG(OutputStream inOutputStream, int inInitialIndentLevel, int inIndentSize)
{
toIndentedXML(inOutputStream, inInitialIndentLevel, inIndentSize);
}
//--------------------------------------------------------------------------
public void toIndentedSVG(PrintWriter inWriter, int inInitialIndentLevel, int inIndentSize)
{
toIndentedXML(inWriter, inInitialIndentLevel, inIndentSize);
}
//--------------------------------------------------------------------------
public void toIndentedSVG(File inFile, int inInitialIndentLevel, int inIndentSize)
{
toIndentedXML(inFile, inInitialIndentLevel, inIndentSize);
}
}