Examples of Writer


Examples of java.io.Writer

        // Check to see if the Writer in the Event was used. If it
        // was, then the listeners contributed concatenated text, and
        // the result needs to be retrieved and sent back.
        if (event.isWriterUsed()) {
            Writer writer = event.getWriter();
            String result = writer.toString();
            writeHttpResponse(out, contentType, result);
        }

        // else - assume that the binary response listeners took care
        // of writing things back on their own,
View Full Code Here

Examples of java.io.Writer

    }

    public void writeTo(String className) {
      try {
        JavaFileObject jfo = filer.createSourceFile(className, (Element[]) null);
        Writer w = jfo.openWriter();
        w.write(p.toString());
        //在com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing中会调用filer.warnIfUnclosedFiles()
        //所以必需要close,否则JavacProcessingEnvironment会出错
        w.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of mil.nga.giat.geowave.accumulo.Writer

      final T object) {
    final ByteArrayId id = getPrimaryId(object);
    addObjectToCache(object);
    try {

      final Writer writer = accumuloOperations.createWriter(
          getAccumuloTablename(),
          true);
      synchronized (this) {
        if (!iteratorsAttached) {
          iteratorsAttached = true;
          final IteratorConfig[] configs = getIteratorConfig();
          if ((configs != null) && (configs.length > 0)) {
            accumuloOperations.attachIterators(
                getAccumuloTablename(),
                true,
                configs);
          }
        }
      }

      final Mutation mutation = new Mutation(
          new Text(
              id.getBytes()));
      final Text cf = getSafeText(getAccumuloColumnFamily());
      final Text cq = getSafeText(getAccumuloColumnQualifier(object));
      final byte[] visibility = getAccumuloVisibility(object);
      if (visibility != null) {
        mutation.put(
            cf,
            cq,
            new ColumnVisibility(
                visibility),
            new Value(
                PersistenceUtils.toBinary(object)));
      }
      else {
        mutation.put(
            cf,
            cq,
            new Value(
                PersistenceUtils.toBinary(object)));
      }
      writer.write(mutation);
      writer.close();
    }
    catch (final TableNotFoundException e) {
      LOGGER.error(
          "Unable add object",
          e);
View Full Code Here

Examples of net.sf.cram.encoding.Writer

    } else {
      slice.alignmentStart = minAlStart;
      slice.alignmentSpan = maxAlEnd - minAlStart;
    }

    Writer writer = f.buildWriter(bos, map, h, slice.sequenceId);
    int prevAlStart = slice.alignmentStart;
    for (CramRecord r : records) {
      r.alignmentStartOffsetFromPreviousRecord = r.getAlignmentStart()
          - prevAlStart;
      prevAlStart = r.getAlignmentStart();
      writer.write(r);
    }

    slice.contentType = slice.alignmentSpan > -1 ? BlockContentType.MAPPED_SLICE
        : BlockContentType.RESERVED;
View Full Code Here

Examples of net.sf.flatpack.writer.Writer

            LOG.warn("No data to marshal as the list is empty");
            return;
        }
        Map<String, Object> firstRow = data.get(0);

        Writer writer = createWriter(exchange, firstRow, stream);
        try {
            boolean first = true;
            writer.printHeader();
            for (Map<String, Object> row : data) {
                if (ignoreFirstRecord && first) {
                    // skip first row
                    first = false;
                    continue;
                }
                for (String key : row.keySet()) {
                    writer.addRecordEntry(key, row.get(key));
                }
                writer.nextRecord();
            }
            writer.printFooter();
        } finally {
            writer.flush();
            writer.close();
        }
    }
View Full Code Here

Examples of net.sf.laja.parser.engine2.Writer

   *
   * @param context
   * @return
   */
  private static GeneratorResult execute(String grammarFile, final boolean forwardRef) {
    final Writer writer = new PrintWriter();
   
    // TODO: Fix this!
    ParsingSettings parsingSettings = new ParsingSettings() {
      @Override
      public boolean isForwardRef() {
        return forwardRef;
      }
    };
    grammarFile = Util.replaceSlash(grammarFile);
   
    writer.writeln("  Reading grammar \"" + grammarFile + "\"");
   
    GrammarParser parser = new GrammarParser(new IGrammarFactoryFactory() {
      public IGrammarFactory getFactory(int phase) {
        return new ParserFactory(writer);
      }}
View Full Code Here

Examples of org.apache.abdera.writer.Writer

    public void writeTo(T element, Class<?> clazz, Type type, Annotation[] a,
                        MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
            Writer w = createWriter("json");
            if (w == null) {
                throw ExceptionUtils.toNotSupportedException(null, null);
            }
            element.writeTo(w, os);  
        } else if (formattedOutput) {
            Writer w = createWriter("prettyxml");
            if (w != null) {
                element.writeTo(w, os);
            } else {
                element.writeTo(os);
            }
View Full Code Here

Examples of org.apache.accumulo.core.client.impl.Writer

  private MetadataTable() {

  }
 
  public synchronized static Writer getMetadataTable(TCredentials credentials) {
    Writer metadataTable = metadata_tables.get(credentials);
    if (metadataTable == null) {
      metadataTable = new Writer(HdfsZooInstance.getInstance(), credentials, Constants.METADATA_TABLE_ID);
      metadata_tables.put(credentials, metadataTable);
    }
    return metadataTable;
  }
View Full Code Here

Examples of org.apache.accumulo.core.file.map.MyMapFile.Writer

    }
   
    Arrays.sort(rands);
   
    Configuration conf = CachedConfiguration.getInstance();
    Writer mfw;
    try {
      FileSystem fs = FileSystem.get(conf);
      mfw = new MyMapFile.Writer(conf, fs, file, Key.class, Value.class, CompressionType.BLOCK);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
   
    for (int i = 0; i < rands.length; i++) {
      Text row = new Text(String.format("row_%010d", rands[i]));
      Key key = new Key(row);
     
      Value dv = new Value(createValue(rands[i], 40));
     
      try {
        mfw.append(key, dv);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
   
    try {
      mfw.close();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of org.apache.accumulo.core.file.rfile.MultiLevelIndex.Writer

  private void runTest(int maxBlockSize, int num) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FSDataOutputStream dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
    CachableBlockFile.Writer _cbw = new CachableBlockFile.Writer(dos, "gz", CachedConfiguration.getInstance());
   
    BufferedWriter mliw = new BufferedWriter(new Writer(_cbw, maxBlockSize));
   
    for (int i = 0; i < num; i++)
      mliw.add(new Key(String.format("%05d000", i)), i, 0, 0, 0);
   
    mliw.addLast(new Key(String.format("%05d000", num)), num, 0, 0, 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.