001 /* 002 * Copyright (c) 2005 Henri Sivonen 003 * Copyright (c) 2007 Mozilla Foundation 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a 006 * copy of this software and associated documentation files (the "Software"), 007 * to deal in the Software without restriction, including without limitation 008 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 009 * and/or sell copies of the Software, and to permit persons to whom the 010 * Software is furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 018 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 020 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 021 * DEALINGS IN THE SOFTWARE. 022 */ 023 024 package nu.validator.xml; 025 026 import java.io.InputStream; 027 import java.io.Reader; 028 029 import org.xml.sax.InputSource; 030 031 /** 032 * @version $Id: TypedInputSource.java 12 2007-09-19 12:45:00Z hsivonen $ 033 * @author hsivonen 034 */ 035 public class TypedInputSource extends InputSource { 036 037 private String type; 038 039 private int length = -1; 040 041 /** 042 * 043 */ 044 public TypedInputSource() { 045 super(); 046 } 047 048 /** 049 * @param arg0 050 */ 051 public TypedInputSource(String arg0) { 052 super(arg0); 053 } 054 055 /** 056 * @param arg0 057 */ 058 public TypedInputSource(InputStream arg0) { 059 super(arg0); 060 } 061 062 /** 063 * @param arg0 064 */ 065 public TypedInputSource(Reader arg0) { 066 super(arg0); 067 } 068 069 070 /** 071 * @return Returns the type. 072 */ 073 public String getType() { 074 return type; 075 } 076 /** 077 * @param type The type to set. 078 */ 079 public void setType(String type) { 080 this.type = type; 081 } 082 083 /** 084 * Returns the length. 085 * 086 * @return the length 087 */ 088 public int getLength() { 089 return length; 090 } 091 092 /** 093 * Sets the length. 094 * 095 * @param length the length to set 096 */ 097 public void setLength(int length) { 098 if (length < -1) { 099 throw new IllegalArgumentException("Length must be -1 or greater."); 100 } 101 this.length = length; 102 } 103 }