/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class AttributeClass {
private int myType;
private int nameLen;
new AttributeClass("attributes-charset",
TAG_CHARSET, "utf-8");
new AttributeClass("attributes-natural-language",
TAG_NATURALLANGUAGE, "en");
/*
* value passed in by IPPPrintService.readIPPResponse is a sequence
* of bytes with this format
* | length1 | byte1 | byte 2 | ... byten | length2 | byte1 ... byten |
* :
* | lengthN | byte1 ... byten | total number of values|
*/
}
public byte getType() {
return (byte)myType;
}
public char[] getLenChars() {
char[] chars = new char[2];
return chars;
}
/**
* Returns raw data.
*/
return myValue;
}
/**
* Returns single int value.
*/
public int getIntValue() {
byte[] buf = new byte[4];
for (int i=0; i<4; i++) {
}
return convertToInt(buf);
}
return 0;
}
/**
* Returns array of int values.
*/
public int[] getArrayOfIntValues() {
//ArrayList valList = new ArrayList();
new ByteArrayInputStream(bufArray);
// total number of values is at the end of the stream
int[] valueArray = new int[length];
for (int i = 0; i < length; i++) {
// read length
if (valLength != 4) {
// invalid data
return null;
}
}
return valueArray;
}
return null;
}
/**
* Returns 2 int values.
*/
public int[] getIntRangeValue() {
for (int j=0; j<2; j++) { // 2 set of integers
// REMIND: # bytes should be 8
for (int i=0; i< nBytes; i++) {
//+ 1 because the 1st byte is length
}
}
}
return range;
}
/**
* Returns String value.
*/
//assumes only 1 attribute value. Will get the first value
// if > 1.
new ByteArrayInputStream(bufArray);
try {
}
}
return strVal;
}
/**
* Returns array of String values.
*/
new ByteArrayInputStream(bufArray);
// total number of values is at the end of the stream
for (int i = 0; i < length; i++) {
// read length
try {
}
}
return valueArray;
}
return null;
}
/**
* Returns single byte value.
*/
public byte getByteValue() {
return bufArray[1];
}
return 0;
}
/**
* Returns attribute name.
*/
return myName;
}
return
obj instanceof AttributeClass &&
}
return myName;
}
private int unsignedByteToInt(byte b) {
return (int) (b & 0xff);
}
int intVal = 0;
int pos = 0;
return intVal;
}
}