OSDN Git Service

Set optimal mime types and executable settings.
[mikumikustudio/MikuMikuStudio.git] / src / com / jmex / xml / types / SchemaBase64Binary.java
1 /**
2  * SchemaBase64Binary.java
3  *
4  * This file was generated by XMLSpy 2007sp2 Enterprise Edition.
5  *
6  * YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
7  * OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
8  *
9  * Refer to the XMLSpy Documentation for further details.
10  * http://www.altova.com/xmlspy
11  */
12
13
14 package com.jmex.xml.types;
15
16
17 public class SchemaBase64Binary extends SchemaBinaryBase {
18   // construction
19   public SchemaBase64Binary() {
20     super();
21   }
22
23   public SchemaBase64Binary(SchemaBase64Binary newvalue) {
24     value = newvalue.value;
25     isempty = newvalue.isempty;
26     isnull = newvalue.isnull;
27   }
28
29   public SchemaBase64Binary(byte[] newvalue) {
30     setValue( newvalue );
31   }
32
33   public SchemaBase64Binary(String newvalue) {
34     parse( newvalue );
35   }
36
37   public SchemaBase64Binary(SchemaType newvalue) {
38     assign( newvalue );
39   }
40
41   public SchemaBase64Binary(SchemaTypeBinary newvalue) {
42     assign( (SchemaType)newvalue );
43   }
44
45   // getValue, setValue
46   public void parse(String s) {
47           
48         String newvalue = SchemaNormalizedString.normalize(SchemaNormalizedString.WHITESPACE_COLLAPSE, s);
49
50     if( newvalue == null )
51       setNull();
52     else if( newvalue.length() == 0)
53       setEmpty();
54     else {
55       setNull();
56           try {
57             value = new sun.misc.BASE64Decoder().decodeBuffer(newvalue);
58         isnull = false;
59         isempty = ( value.length == 0 ) ? true : false;
60           }
61           catch( java.io.IOException e ) {
62                 value = null;
63           }
64     }
65   }
66
67   // further
68   public int hashCode() {
69     return value.hashCode();
70   }
71
72   public boolean equals(Object obj) {
73     if (! (obj instanceof SchemaBase64Binary))
74       return false;
75     return value.equals(( (SchemaBase64Binary) obj).value);
76   }
77
78   public Object clone() {
79     return new SchemaBase64Binary( this );
80   }
81
82   public String toString() {
83     if( isempty || isnull || value == null )
84       return "";
85     String sResult = new sun.misc.BASE64Encoder().encode(value);
86         return sResult.replaceAll( "\r", "" );
87   }
88
89   // ---------- interface SchemaTypeBinary ----------
90   public int binaryType() {
91           return BINARY_VALUE_BASE64;
92   }
93 }