Examples of truncate()


Examples of in.partake.model.dao.access.IUserTicketAccess.truncate()

    }

    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IUserTicketAccess dao = daos.getEnrollmentAccess();

        dao.truncate(con);
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_ENROLLED_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.ENROLLED,
                ModificationStatus.CHANGED, AttendanceStatus.PRESENT, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null));
        dao.put(con, new UserTicket(UUID.randomUUID().toString(),
                EVENT_RESERVED_USER_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_EVENT_ID, "comment", ParticipationStatus.RESERVED,
View Full Code Here

Examples of in.partake.model.dao.access.IUserTwitterLinkAccess.truncate()

        return array;
    }

    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IUserTwitterLinkAccess dao = daos.getTwitterLinkageAccess();
        dao.truncate(con);


        for (int i = 0; i < DEFAULT_USER_IDS.length; ++i)
            dao.put(con, new UserTwitterLink(DEFAULT_TWITTER_LINK_IDS[i], DEFAULT_USER_TWITTER_IDS[i], DEFAULT_USER_IDS[i], DEFAULT_USER_TWITTER_SCREENNAME[i], "testUser 1", "accessToken", "accessTokenSecret", "http://www.example.com/"));
View Full Code Here

Examples of io.druid.granularity.PeriodGranularity.truncate()

      );

      // Schedule termination of worker nodes periodically
      Period period = config.getTerminatePeriod();
      PeriodGranularity granularity = new PeriodGranularity(period, config.getOriginTime(), null);
      final long startTime = granularity.next(granularity.truncate(new DateTime().getMillis()));

      ScheduledExecutors.scheduleAtFixedRate(
          exec,
          new Duration(System.currentTimeMillis(), startTime),
          config.getTerminatePeriod().toStandardDuration(),
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

            fileChannel.position(fileChannel.size());
            // FIXME: This worries me a bit, since it could allocate a lot with a large newLength
            fileChannel.write(ByteBuffer.allocate(difference));
            fileChannel.position(position);
        } else {
            fileChannel.truncate(newLength);
        }       
    }
   
    /**
     * Invalidate buffer before a position change has occurred (e.g. seek),
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

            else
                args.put("latest_time", lastTime);
                addEndOfLine = true;

            FileChannel fc = raf.getChannel();
            fc.truncate(fptrEof);
        } else
        if (!file.createNewFile())
            throw new Error("Failed to create output file");

        // Search args
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

            FileUtil.createNewFile(target);
        } else if (endpoint.getFileExist() == GenericFileExist.Override) {
            LOG.debug("Truncating existing file: {}", target);
            FileChannel out = new FileOutputStream(target).getChannel();
            try {
                out.truncate(0);
            } finally {
                IOHelper.close(out, target.getName(), LOG, endpoint.isForceWrites());
            }
        }
    }
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

            Object value = attributes.get(attribute);
            switch (attribute) {
            case Size: {
                long newSize = (Long) value;
                FileChannel outChan = new FileOutputStream(file, true).getChannel();
                outChan.truncate(newSize);
                outChan.close();
                continue;
            }
            case LastModifiedTime:
                setLastModified((Long) value);
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

            Object value = attributes.get(attribute);
            switch (attribute) {
                case Size:             {
                    long newSize = (Long) value;
                    FileChannel outChan = new FileOutputStream(file, true).getChannel();
                    outChan.truncate(newSize);
                    outChan.close();
                    continue;
                }
                case Uid:              name = "unix:uid"; break;
                case Gid:              name = "unix:gid"; break;
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

          FileOutputStream s = null;
          FileChannel channel = null;
          try {
            s = new FileOutputStream(f);
            channel = s.getChannel();
            channel.truncate(0);
            LOG.info("Truncated block file " + f.getAbsolutePath());
            return b.getBlockId();
          } finally {
            IOUtils.cleanup(LOG, channel, s);
          }
View Full Code Here

Examples of java.nio.channels.FileChannel.truncate()

    // binary, XML, reparsed binary
    String edits = nnHelper.generateEdits();
    FileOutputStream os = new FileOutputStream(edits, true);
    // Corrupt the file by truncating the end
    FileChannel editsFile = os.getChannel();
    editsFile.truncate(editsFile.size() - 5);

    String editsParsedXml = folder.newFile("editsRecoveredParsed.xml")
        .getAbsolutePath();
    String editsReparsed = folder.newFile("editsRecoveredReparsed")
        .getAbsolutePath();
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.