Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*     */ package com.sun.xml.bind.v2.runtime.unmarshaller;
  /*     */ 
  /*     */ import com.sun.xml.bind.WhiteSpaceProcessor;
  /*     */ import  com.sun.xml.fastinfoset.stax.StAXDocumentParser;
  /*     */ import javax.xml.stream.Location;
  /*     */ import javax.xml.stream.XMLStreamException;
  /*     */ import org.xml.sax.SAXException;
  /*     */ 
  /*     */ final class FastInfosetConnector extends StAXConnector
 /*     */ {
 /*     */   private final StAXDocumentParser fastInfosetStreamReader;
 /*     */   private boolean textReported;
 /*  64 */   private final Base64Data base64Data = new Base64Data();
 /*     */ 
 /*  67 */   private final StringBuilder buffer = new StringBuilder();
 /*     */ 
 /* 248 */   private final CharSequenceImpl charArray = new CharSequenceImpl();
 /*     */ 
 /*     */   public FastInfosetConnector(StAXDocumentParser fastInfosetStreamReaderXmlVisitor visitor)
 /*     */   {
 /*  71 */     super(visitor);
 /*  72 */     fastInfosetStreamReader.setStringInterning(true);
 /*  73 */     this. = fastInfosetStreamReader;
 /*     */   }
 /*     */ 
 /*     */   public void bridge() throws XMLStreamException
 /*     */   {
 /*     */     try {
 /*  79 */       int depth = 0;
 /*     */ 
 /*  82 */       int event = this..getEventType();
 /*  83 */       if (event == 7)
 /*     */       {
 /*  85 */         while (!this..isStartElement()) {
 /*  86 */           event = this..next();
 /*     */         }
 /*     */       }
 /*     */ 
 /*  90 */       if (event != 1) {
 /*  91 */         throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event);
 /*     */       }
 /*     */ 
 /*  95 */       handleStartDocument(this..getNamespaceContext());
 /*     */       while (true)
 /*     */       {
 /* 102 */         switch (event) {
 /*     */         case 1:
 /* 104 */           handleStartElement();
 /* 105 */           depth++;
 /* 106 */           break;
 /*     */         case 2:
 /* 108 */           depth--;
 /* 109 */           handleEndElement();
 /* 110 */           if (depth != 0) breakbreak;
 /*     */         case 4:
 /*     */         case 6:
 /*     */         case 12:
 /* 115 */           if (!this..expectText()) {
 /*     */             break;
 /*     */           }
 /* 118 */           event = this..peekNext();
 /* 119 */           if (event == 2)
 /* 120 */             processNonIgnorableText();
 /* 121 */           else if (event == 1)
 /* 122 */             processIgnorableText();
 /*     */           else
 /* 124 */             handleFragmentedCharacters(); case 3:
 /*     */         case 5:
 /*     */         case 7:
 /*     */         case 8:
 /*     */         case 9:
 /*     */         case 10:
 /* 130 */         case 11: } event = this..next();
 /*     */       }
 /*     */ 
 /* 133 */       this..next();
 /*     */ 
 /* 135 */       handleEndDocument();
 /*     */     } catch (SAXException e) {
 /* 137 */       throw new XMLStreamException(e);
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   protected Location getCurrentLocation() {
 /* 142 */     return this..getLocation();
 /*     */   }
 /*     */ 
 /*     */   protected String getCurrentQName() {
 /* 146 */     return this..getNameString();
 /*     */   }
 /*     */ 
 /*     */   private void handleStartElement() throws SAXException {
 /* 150 */     processUnreportedText();
 /*     */ 
 /* 152 */     for (int i = 0; i < this..accessNamespaceCount(); i++) {
 /* 153 */       this..startPrefixMapping(this..getNamespacePrefix(i), this..getNamespaceURI(i));
 /*     */     }
 /*     */ 
 /* 157 */     this.. = this..accessNamespaceURI();
/* 158 */     this.. = this..accessLocalName();
/* 159 */     this.. = this..getAttributesHolder();
/*     */ 
/* 161 */     this..startElement(this.);
/*     */   }
/*     */ 
/*     */   private void handleFragmentedCharacters() throws XMLStreamExceptionSAXException {
/* 165 */     this..setLength(0);
/*     */ 
/* 168 */     this..append(this..accessTextCharacters(), this..accessTextStart(), this..accessTextLength());
/*     */     while (true)
/*     */     {
/* 174 */       switch (this..peekNext()) {
/*     */       case 1:
/* 176 */         processBufferedText(true);
/* 177 */         return;
/*     */       case 2:
/* 179 */         processBufferedText(false);
/* 180 */         return;
/*     */       case 4:
/*     */       case 6:
/*     */       case 12:
/* 185 */         this..next();
/* 186 */         this..append(this..accessTextCharacters(), this..accessTextStart(), this..accessTextLength());
/*     */ 
/* 189 */         break;
/*     */       case 3:
/*     */       case 5:
/*     */       case 7:
/*     */       case 8:
/*     */       case 9:
/*     */       case 10:
/*     */       case 11:
/*     */       default:
/* 191 */         this..next();
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void handleEndElement() throws SAXException {
/* 197 */     processUnreportedText();
/*     */ 
/* 199 */     this.. = this..accessNamespaceURI();
/* 200 */     this.. = this..accessLocalName();
/*     */ 
/* 202 */     this..endElement(this.);
/*     */ 
/* 204 */     for (int i = this..accessNamespaceCount() - 1; i >= 0; i--)
/* 205 */       this..endPrefixMapping(this..getNamespacePrefix(i));
/*     */   }
/*     */ 
/*     */   private void processNonIgnorableText()
/*     */     throws SAXException
/*     */   {
/* 251 */     this. = true;
/* 252 */     if (this..getTextAlgorithmBytes() == null) {
/* 253 */       this..set();
/* 254 */       this..text(this.);
/*     */     } else {
/* 256 */       this..set(this..getTextAlgorithmBytesClone(), null);
/* 257 */       this..text(this.);
/*     */     }
/*     */   }
/*     */ 
/*     */   private void processIgnorableText() throws SAXException {
/* 262 */     if (this..getTextAlgorithmBytes() == null) {
/* 263 */       this..set();
/* 264 */       if (!WhiteSpaceProcessor.isWhiteSpace(this.)) {
/* 265 */         this..text(this.);
/* 266 */         this. = true;
/*     */       }
/*     */     } else {
/* 269 */       this..set(this..getTextAlgorithmBytesClone(), null);
/* 270 */       this..text(this.);
/* 271 */       this. = true;
/*     */     }
/*     */   }
/*     */ 
/*     */   private void processBufferedText(boolean ignorablethrows SAXException {
/* 276 */     if ((!ignorable) || (!WhiteSpaceProcessor.isWhiteSpace(this.))) {
/* 277 */       this..text(this.);
/* 278 */       this. = true;
/*     */     }
/*     */   }
/*     */ 
/*     */   private void processUnreportedText() throws SAXException {
/* 283 */     if ((!this.) && (this..expectText())) {
/* 284 */       this..text("");
/*     */     }
/* 286 */     this. = false;
/*     */   }
/*     */ 
/*     */   private final class CharSequenceImpl
/*     */     implements CharSequence
/*     */   {
/*     */     char[] ch;
/*     */     int start;
/*     */     int length;
/*     */ 
/*     */     CharSequenceImpl()
/*     */     {
/*     */     }
/*     */ 
/*     */     CharSequenceImpl(char[] chint startint length)
/*     */     {
/* 218 */       this. = ch;
/* 219 */       this. = start;
/* 220 */       this. = length;
/*     */     }
/*     */ 
/*     */     public void set() {
/* 224 */       this. = FastInfosetConnector.this..accessTextCharacters();
/* 225 */       this. = FastInfosetConnector.this..accessTextStart();
/* 226 */       this. = FastInfosetConnector.this..accessTextLength();
/*     */     }
/*     */ 
/*     */     public final int length()
/*     */     {
/* 232 */       return this.;
/*     */     }
/*     */ 
/*     */     public final char charAt(int index) {
/* 236 */       return this.[(this. + index)];
/*     */     }
/*     */ 
/*     */     public final CharSequence subSequence(int startint end) {
/* 240 */       return new CharSequenceImpl(FastInfosetConnector.thisthis.this. + startend - start);
/*     */     }
/*     */ 
/*     */     public String toString() {
/* 244 */       return new String(this.this.this.);
/*     */     }
/*     */   }
/*     */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/thirdparty-all.jar
 * Qualified Name:     com.sun.xml.bind.v2.runtime.unmarshaller.FastInfosetConnector
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X