Package com.ngt.jopenmetaverse.shared.structureddata

Examples of com.ngt.jopenmetaverse.shared.structureddata.OSDException


                     osd = OSD.FromBoolean(true);
                     break;
                 case trueNotationValueTwo:
                     matching = BufferCharactersEqual(reader, trueNotationValueTwoFull, 1);
                     if (matching > 1 && matching < trueNotationValueTwoFull.length)
                         throw new OSDException("Notation LLSD parsing: True value parsing error:");
                     osd = OSD.FromBoolean(true);
                     break;
                 case trueNotationValueThree:
                     matching = BufferCharactersEqual(reader, trueNotationValueThreeFull, 1);
                     if (matching > 1 && matching < trueNotationValueThreeFull.length)
                         throw new OSDException("Notation LLSD parsing: True value parsing error:");
                     osd = OSD.FromBoolean(true);
                     break;
                 case falseNotationValueOne:
                     osd = OSD.FromBoolean(false);
                     break;
                 case falseNotationValueTwo:
                     matching = BufferCharactersEqual(reader, falseNotationValueTwoFull, 1);
                     if (matching > 1 && matching < falseNotationValueTwoFull.length)
                         throw new OSDException("Notation LLSD parsing: True value parsing error:");
                     osd = OSD.FromBoolean(false);
                     break;
                 case falseNotationValueThree:
                     matching = BufferCharactersEqual(reader, falseNotationValueThreeFull, 1);
                     if (matching > 1 && matching < falseNotationValueThreeFull.length)
                         throw new OSDException("Notation LLSD parsing: True value parsing error:");
                     osd = OSD.FromBoolean(false);
                     break;
                 case integerNotationMarker:
                     osd = DeserializeLLSDNotationInteger(reader);
                     break;
                 case realNotationMarker:
                     osd = DeserializeLLSDNotationReal(reader);
                     break;
                 case uuidNotationMarker:
                     char[] uuidBuf = new char[36];
                     if (reader.read(uuidBuf, 0, 36) < 36)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in UUID.");
                     UUID[] lluuid = new UUID[1];
                     if (!UUID.TryParse(new String(uuidBuf), lluuid))
                         throw new OSDException("Notation LLSD parsing: Invalid UUID discovered.");
                     osd = OSD.FromUUID(lluuid[0]);
                     break;
                 case binaryNotationMarker:
                     byte[] bytes = Utils.EmptyBytes;
                     reader.mark(2);
                     int bChar = reader.read();
                     if (bChar < 0)
                     {
                       reader.reset();
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                     }
                     if ((char)bChar == sizeBeginNotationMarker)
                     {
                       reader.reset();
                         throw new OSDException("Notation LLSD parsing: Raw binary encoding not supported.");
                     }
                     else if (Character.isDigit((char)bChar))
                     {
                       reader.reset();
                         char[] charsBaseEncoding = new char[2];
                         if (reader.read(charsBaseEncoding, 0, 2) < 2)
                             throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                         int baseEncoding[] = new int[1];
                         if (!Utils.tryParseInt(new String(charsBaseEncoding), baseEncoding))
                             throw new OSDException("Notation LLSD parsing: Invalid binary encoding base.");
                         if (baseEncoding[0] == 64)
                         {
                             if (reader.read() < 0)
                                 throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                             String bytes64 = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
                            
                             bytes = Utils.decodeBase64String(bytes64);
                         }
                         else
                         {
                             throw new OSDException("Notation LLSD parsing: Encoding base" + baseEncoding + " + not supported.");
                         }
                     }
                     osd = OSD.FromBinary(bytes);
                     break;
                 case StringNotationMarker:
                     int numChars = GetLengthInBrackets(reader);
                     if (reader.read() < 0)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in String.");
                     char[] chars = new char[numChars];
                     if (reader.read(chars, 0, numChars) < numChars)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in String.");
                     if (reader.read() < 0)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in String.");
                     osd = OSD.FromString(new String(chars));
                     break;
                 case singleQuotesNotationMarker:
                     String sOne = GetStringDelimitedBy(reader, singleQuotesNotationMarker);
                     osd = OSD.FromString(sOne);
                     break;
                 case doubleQuotesNotationMarker:
                     String sTwo = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
                     osd = OSD.FromString(sTwo);
                     break;
                 case uriNotationMarker:
                     if (reader.read() < 0)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in String.");
                     String sUri = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
                     //System.out.println("URI: " + sUri);
                     URI[] uri = new URI[1];
                     if(Utils.tryParseUri(sUri, uri))
                     {
                         osd = OSD.FromUri(uri[0]);
                     }
                     else
                         throw new OSDException("Notation LLSD parsing: Invalid Uri format detected.");                   
                     break;
                 case dateNotationMarker:
                     if (reader.read() < 0)
                         throw new OSDException("Notation LLSD parsing: Unexpected end of stream in date.");
                     String date = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
                     Date dt[] = new Date[1];
                     if (!Utils.tryParseDate(date, dt))
                         throw new OSDException("Notation LLSD parsing: Invalid date discovered.");
                     osd = OSD.FromDate(dt[0]);
                     break;
                 case arrayBeginNotationMarker:
                     osd = DeserializeLLSDNotationArray(reader);
                     break;
                 case mapBeginNotationMarker:
                     osd = DeserializeLLSDNotationMap(reader);
                     break;
                 default:
                     throw new OSDException("Notation LLSD parsing: Unknown type marker '" + (char)character + "'.");
             }
             return osd;
         }
View Full Code Here


                 reader.mark(2);
             }
             reader.reset();
             int integer[] = new int[1];
             if (!Utils.tryParseInt(s.toString(), integer))
                 throw new OSDException("Notation LLSD parsing: Can't parse integer value." + s.toString());

             return OSD.FromInteger(integer[0]);
         }
View Full Code Here

                 s.append((char)character);
                 reader.mark(2);
             }
             double dbl[] = new double[1];
             if (!Utils.tryParseDouble(s.toString(), dbl))
                 throw new OSDException("Notation LLSD parsing: Can't parse real value: " + s.toString());

           reader.reset();
             return OSD.FromReal(dbl[0]);
         }
View Full Code Here

                 osdArray.add(DeserializeLLSDNotationElement(reader));

                 character = ReadAndSkipWhitespace(reader);
//               System.out.print((char)character);
                 if (character < 0)
                     throw new OSDException("Notation LLSD parsing: Unexpected end of array discovered.");
                 else if ((char)character == kommaNotationDelimiter)
                     continue;
                 else if ((char)character == arrayEndNotationMarker)
                     break;
             }
             if (character < 0)
                 throw new OSDException("Notation LLSD parsing: Unexpected end of array discovered.");

             return (OSD)osdArray;
         }
View Full Code Here

             while (((character = PeekAndSkipWhitespace(reader)) > 0) &&
                   ((char)character != mapEndNotationMarker))
             {
                 OSD osdKey = DeserializeLLSDNotationElement(reader);
                 if (osdKey.getType() != OSDType.String)
                     throw new OSDException("Notation LLSD parsing: Invalid key in map");
                 String key = osdKey.asString();

                 character = ReadAndSkipWhitespace(reader);
                 if ((char)character != keyNotationDelimiter)
                     throw new OSDException("Notation LLSD parsing: Unexpected end of stream in map.");
                 if ((char)character != keyNotationDelimiter)
                     throw new OSDException("Notation LLSD parsing: Invalid delimiter in map.");

                 osdMap.put(key, DeserializeLLSDNotationElement(reader));
                 character = ReadAndSkipWhitespace(reader);
                 if (character < 0)
                     throw new OSDException("Notation LLSD parsing: Unexpected end of map discovered.");
                 else if ((char)character == kommaNotationDelimiter)
                     continue;
                 else if ((char)character == mapEndNotationMarker)
                     break;
             }
             if (character < 0)
                 throw new OSDException("Notation LLSD parsing: Unexpected end of map discovered.");

             return (OSD)osdMap;
         }
View Full Code Here

                     break;
                 case Map:
                     SerializeLLSDNotationMap(writer, (OSDMap)osd);
                     break;
                 default:
                     throw new OSDException("Notation serialization: Not existing element discovered.");

             }
         }
View Full Code Here

                     break;
                 case Map:
                     SerializeLLSDNotationMapFormatted(writer, indent + baseIndent, (OSDMap)osd);
                     break;
                 default:
                     throw new OSDException("Notation serialization: Not existing element discovered.");

             }
         }
View Full Code Here

                   ((char)character != sizeEndNotationMarker))
             {
                 s.append((char)character);
             }
             if (character < 0)
                 throw new OSDException("Notation LLSD parsing: Can't parse length value cause unexpected end of stream.");
             int length[] = new int[1];
            
             if (!Utils.tryParseInt(s.toString(), length))
                 throw new OSDException("Notation LLSD parsing: Can't parse length value.");

             return length[0];
         }
View Full Code Here

                 else
                     s.append((char)character);

             }
             if (character < 0)
                 throw new OSDException("Notation LLSD parsing: Can't parse text because unexpected end of stream while expecting a '"
                                             + delimiter + "' character.");

             return s.toString();
         }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.structureddata.OSDException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.