11 |
13 Sep 07 |
nicklas |
1 |
/* |
11 |
13 Sep 07 |
nicklas |
* MIMEValue.java |
11 |
13 Sep 07 |
nicklas |
3 |
* |
11 |
13 Sep 07 |
nicklas |
* Created on October 20, 2005, 4:11 PM |
11 |
13 Sep 07 |
nicklas |
5 |
* |
11 |
13 Sep 07 |
nicklas |
* To change this template, choose Tools | Options and locate the template under |
11 |
13 Sep 07 |
nicklas |
* the Source Creation and Management node. Right-click the template and choose |
11 |
13 Sep 07 |
nicklas |
* Open. You can then make changes to the template in the Source Editor. |
11 |
13 Sep 07 |
nicklas |
9 |
*/ |
11 |
13 Sep 07 |
nicklas |
10 |
|
11 |
13 Sep 07 |
nicklas |
11 |
package affymetrix.calvin.parameter; |
11 |
13 Sep 07 |
nicklas |
12 |
|
11 |
13 Sep 07 |
nicklas |
13 |
/** |
11 |
13 Sep 07 |
nicklas |
14 |
* |
11 |
13 Sep 07 |
nicklas |
* @author ljevon |
11 |
13 Sep 07 |
nicklas |
16 |
*/ |
11 |
13 Sep 07 |
nicklas |
17 |
public class MIMEValue { |
11 |
13 Sep 07 |
nicklas |
18 |
|
11 |
13 Sep 07 |
nicklas |
19 |
|
11 |
13 Sep 07 |
nicklas |
/** Custom MIME types */ |
11 |
13 Sep 07 |
nicklas |
21 |
public static final String Int8MIMEType = "text/x-calvin-integer-8"; |
11 |
13 Sep 07 |
nicklas |
22 |
public static final String UInt8MIMEType = "text/x-calvin-unsigned-integer-8"; |
11 |
13 Sep 07 |
nicklas |
23 |
public static final String Int16MIMEType = "text/x-calvin-integer-16"; |
11 |
13 Sep 07 |
nicklas |
24 |
public static final String UInt16MIMEType = "text/x-calvin-unsigned-integer-16"; |
11 |
13 Sep 07 |
nicklas |
25 |
public static final String Int32MIMEType = "text/x-calvin-integer-32"; |
11 |
13 Sep 07 |
nicklas |
26 |
public static final String UInt32MIMEType = "text/x-calvin-unsigned-integer-32"; |
11 |
13 Sep 07 |
nicklas |
27 |
public static final String FloatMIMEType = "text/x-calvin-float"; |
11 |
13 Sep 07 |
nicklas |
28 |
public static final String TextMIMEType = "text/plain"; |
11 |
13 Sep 07 |
nicklas |
29 |
public static final String AsciiMIMEType = "text/ascii"; |
11 |
13 Sep 07 |
nicklas |
30 |
|
11 |
13 Sep 07 |
nicklas |
/** Constructs a MIME value - default constructor */ |
11 |
13 Sep 07 |
nicklas |
32 |
public MIMEValue() { |
11 |
13 Sep 07 |
nicklas |
33 |
arr = null; |
11 |
13 Sep 07 |
nicklas |
34 |
arrSize = 0; |
11 |
13 Sep 07 |
nicklas |
35 |
} |
11 |
13 Sep 07 |
nicklas |
36 |
|
11 |
13 Sep 07 |
nicklas |
/** Constructs a MIME value |
11 |
13 Sep 07 |
nicklas |
* @param value A pointer to array containing the MIME encoded value |
11 |
13 Sep 07 |
nicklas |
* @param size The size of the array |
11 |
13 Sep 07 |
nicklas |
40 |
*/ |
11 |
13 Sep 07 |
nicklas |
41 |
public MIMEValue(byte[] value, int size) { |
11 |
13 Sep 07 |
nicklas |
42 |
setValue(value, size); |
11 |
13 Sep 07 |
nicklas |
43 |
} |
11 |
13 Sep 07 |
nicklas |
44 |
|
11 |
13 Sep 07 |
nicklas |
/** Operator equals |
11 |
13 Sep 07 |
nicklas |
* @param lhs The left hand side to compare. |
11 |
13 Sep 07 |
nicklas |
* @return True if the same. |
11 |
13 Sep 07 |
nicklas |
48 |
*/ |
11 |
13 Sep 07 |
nicklas |
49 |
public boolean equals(MIMEValue lhs) { |
11 |
13 Sep 07 |
nicklas |
50 |
if (arrSize != lhs.size()) |
11 |
13 Sep 07 |
nicklas |
51 |
return false; |
11 |
13 Sep 07 |
nicklas |
52 |
return (arr == lhs.getBytes()); |
11 |
13 Sep 07 |
nicklas |
53 |
} |
11 |
13 Sep 07 |
nicklas |
54 |
|
11 |
13 Sep 07 |
nicklas |
/** Set the controlled value |
11 |
13 Sep 07 |
nicklas |
* @param value A pointer to array containing the MIME encoded value |
11 |
13 Sep 07 |
nicklas |
* @param size The size of the array |
11 |
13 Sep 07 |
nicklas |
58 |
*/ |
11 |
13 Sep 07 |
nicklas |
59 |
public void setValue(byte[] value, int size) { |
11 |
13 Sep 07 |
nicklas |
60 |
arr = value; |
11 |
13 Sep 07 |
nicklas |
61 |
arrSize = size; |
11 |
13 Sep 07 |
nicklas |
62 |
} |
11 |
13 Sep 07 |
nicklas |
63 |
|
11 |
13 Sep 07 |
nicklas |
/** Get the controlled value |
11 |
13 Sep 07 |
nicklas |
* @return Const pointer to the MIME value array. (for writing)*/ |
11 |
13 Sep 07 |
nicklas |
66 |
public byte[] getBytes() { return arr; } |
11 |
13 Sep 07 |
nicklas |
67 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the size of the array */ |
11 |
13 Sep 07 |
nicklas |
69 |
public int size() { return arrSize; } |
11 |
13 Sep 07 |
nicklas |
70 |
|
11 |
13 Sep 07 |
nicklas |
/** The buffer to hold the data. */ |
11 |
13 Sep 07 |
nicklas |
72 |
private byte[] arr; |
11 |
13 Sep 07 |
nicklas |
73 |
|
11 |
13 Sep 07 |
nicklas |
/** The size of the buffer. */ |
11 |
13 Sep 07 |
nicklas |
75 |
private int arrSize; |
11 |
13 Sep 07 |
nicklas |
76 |
} |