Examples of SnapshotWriter


Examples of com.google.enterprise.connector.util.diffing.SnapshotWriter

  private SnapshotWriter writer;

  @Override
  public void setUp() throws Exception {
    sw = new StringWriter();
    writer = new SnapshotWriter(sw, null, "string");
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.SnapshotWriter

          throws IOException {
        throw new IOException();
      }

    }
    writer = new SnapshotWriter(new FailingWriter(), null, "string");

    MockDocumentSnapshot before = new MockDocumentSnapshot("0", "extra.0");
    try {
      writeAndClose(writer, before);
      fail("write worked!?");
View Full Code Here

Examples of com.opengamma.integration.copier.snapshot.writer.SnapshotWriter

    s_context = getToolContext();
    SnapshotUtils snapshotUtils = SnapshotUtils.of(s_context.getMarketDataSnapshotMaster());
    if (!MarketDataSnapshotToolUtils.handleQueryOptions(snapshotUtils, getCommandLine())) {
      SnapshotReader snapshotReader = constructSnapshotReader(UniqueId.parse(getCommandLine().getOptionValue(
          SNAPSHOT_UID_OPTION)));
      SnapshotWriter snapshotWriter = constructSnapshotWriter(getCommandLine().getOptionValue(FILE_NAME_OPTION));
      SnapshotCopier snapshotCopier = new SimpleSnapshotCopier();
 
      snapshotCopier.copy(snapshotReader, snapshotWriter);
 
      // close the reader and writer
      snapshotReader.close();
      snapshotWriter.close();
    }
    System.exit(0);
  }
View Full Code Here

Examples of com.opengamma.integration.copier.snapshot.writer.SnapshotWriter

  @Override
  protected void doRun() throws Exception {
    s_context = getToolContext();

    SnapshotReader snapshotReader = constructSnapshotReader(getCommandLine().getOptionValue(FILE_NAME_OPTION));
    SnapshotWriter snapshotWriter = constructSnapshotWriter();
    SnapshotCopier snapshotCopier = new SimpleSnapshotCopier();

    snapshotCopier.copy(snapshotReader, snapshotWriter);

    // close the reader and writer
    snapshotReader.close();
    snapshotWriter.close();

  }
View Full Code Here

Examples of org.tarantool.snapshot.SnapshotWriter

   * @param args
   * @throws IOException
   */
  public void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream("/tmp/user.gz")), "utf-8"));
    SnapshotWriter writer = new SnapshotWriter(new FileOutputStream("/tmp/user.snap").getChannel());
    String line = null;
    DateFormat indf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    DateFormat outdf = new SimpleDateFormat("yyyyMMddhhmmss");
    Pattern pattern = Pattern.compile("\t");
    while ((line = reader.readLine()) != null) {
      try {
        String[] values = pattern.split(line);
        if (values.length == 5) {
          // 1 username email@domain.tld 1 2012-10-14 01:27:05
          Integer id = Integer.parseInt(values[0]);
          String username = values[1];
          String email = values[2];
          byte[] enabled = { Byte.valueOf(values[3]) };
          Long registered = Long.parseLong(outdf.format(indf.parse(values[4])));
          Tuple tuple = new Tuple(5).setInt(0, id).setString(1, username, "UTF-8").setString(2, email, "UTF-8").setBytes(3, enabled)
              .setLong(4, registered);

          writer.writeRow(0, tuple);
        } else {
          System.err.println("Line should be splited in 5 parts, but has " + values.length + " for " + line);
        }
      } catch (Exception e) {
        System.err.println("Can't parse line " + line);
        e.printStackTrace();
      }
    }
    writer.close();
    reader.close();
    SocketChannelTarantoolConnection con = new SocketChannelTarantoolConnection();
    Tuple t = con.findOne(0, 0, 0, new Tuple(1).setInt(0, 1));
    System.out.println(t.getLong(4));
    con.close();
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.