Package dtool.util

Examples of dtool.util.JsonReaderExt


      dubError = new DubBundleException(message);
    }
  }
 
  protected void parseFromSource(String source) throws DubBundleException {
    try(JsonReaderExt jsonParser = new JsonReaderExt(new StringReader(source))) {
      jsonParser.setLenient(true);
     
      readData(jsonParser);
     
      jsonParser.consumeExpected(JsonToken.END_DOCUMENT);
      assertTrue(jsonParser.peek() == JsonToken.END_DOCUMENT);
    } catch (IOException e) {
      throw new DubBundleException(e);
    }
  }
View Full Code Here


      try(
        BufferedReader serverInput = new BufferedReader(
          new InputStreamReader(clientSocket.getInputStream(), StringUtil.UTF8));
        OutputStreamWriter serverResponse =
          new OutputStreamWriter(clientSocket.getOutputStream(), StringUtil.UTF8);
        JsonReaderExt jsonParser = new JsonReaderExt(serverInput);
        JsonWriterExt jsonWriter = new JsonWriterExt(serverResponse);
      ) {
       
        try {
          jsonParser.setLenient(true);
          jsonWriter.setLenient(true);
         
          while(!jsonParser.isEOF()) {
            processJsonMessage(jsonParser, jsonWriter);
          }
        } catch (MalformedJsonException jsonException) {
          logProtocolMessageError(jsonException);
          return;
View Full Code Here

   
    @Override
    protected FindDefinitionResult doOperation(Path filePath, int offset) throws GenieCommandException {
      try {
        String response = new FindDefinitionRequest().setArguments(filePath, offset).performAndGetResponse();
        return new FindDefinitionResultParser().read(new JsonReaderExt(new StringReader(response)));
      } catch (IOException e) {
        throw assertFail();
      }
    }
View Full Code Here

    protected FindDefinitionResult doOperation(Path filePath, int offset) throws GenieCommandException {
      try {
        new FindDefinitionRequest().setArguments(filePath, offset).
          writeRequest(new JsonWriterExt(serverInput));
       
        return new FindDefinitionResultParser().read(new JsonReaderExt(serverOutput));
      } catch (IOException e) {
        throw assertFail();
      }
    }
View Full Code Here

  }
 
  /* ----------------- reading helpers ----------------- */
 
  public static HashMap<String,Object> readObject(Reader source) throws IOException {
    JsonReaderExt jsonParser = new JsonReaderExt(source);
    return JsonReaderExt.readJsonObject(jsonParser);
  }
View Full Code Here

    return JsonReaderExt.readJsonObject(jsonParser);
  }
 
  public static HashMap<String, Object> readJsonObject(String source) {
    try {
      return new JsonReaderExt(new StringReader(source)).readJsonObject();
    } catch (IOException e) {
      throw assertUnreachable();
    }
  }
View Full Code Here

     
      InputStoringReader<StringWriter> serverOutStoringReader = InputStoringReader.createDefault(serverOutput);
     
      try(
        JsonWriterExt jsonWriter = new JsonWriterExt(serverInput);
        JsonReaderExt jsonReader = new JsonReaderExt(serverOutStoringReader);
      ) {
       
        jsonWriter.setLenient(true);
        jsonReader.setLenient(true);
       
        writeRequest(jsonWriter);
       
        jsonReader.skipValue();
        String responseString = serverOutStoringReader.getStoredInput().toString();
        return responseString;
      }
    } catch (IOException ioe) {
      throw errorBail("Exception during client request.", ioe);
View Full Code Here

TOP

Related Classes of dtool.util.JsonReaderExt

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.