Java ByteBuffer Fill fillBufFromTime(ByteBuffer buf, Calendar cal)

Here you can find the source of fillBufFromTime(ByteBuffer buf, Calendar cal)

Description

fill Buf From Time

License

Open Source License

Declaration

private static void fillBufFromTime(ByteBuffer buf, Calendar cal) 

Method Source Code

//package com.java2s;
/*/*from  www  . ja  va  2 s . co m*/
 * Copyright (C) 2006 Steve Ratcliffe
 * 
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 * 
 * Author: Steve Ratcliffe
 * Create date: 03-Dec-2006
 */

import java.nio.ByteBuffer;

import java.util.Calendar;

public class Main {
    private static void fillBufFromTime(ByteBuffer buf, Calendar cal) {
        buf.putChar((char) cal.get(Calendar.YEAR));
        buf.put((byte) (cal.get(Calendar.MONTH) + 1));
        buf.put((byte) cal.get(Calendar.DAY_OF_MONTH));
        buf.put((byte) cal.get(Calendar.HOUR_OF_DAY));
        buf.put((byte) cal.get(Calendar.MINUTE));
        buf.put((byte) cal.get(Calendar.SECOND));
    }
}

Related

  1. fill(ByteBuffer buffer, int off, int len, byte val)
  2. fill(ByteBuffer buffer, int position, int length, byte filler)
  3. fill(ByteBuffer to, byte[] b, int off, int len)
  4. fillBuffer(ByteBuffer buffer, byte[] bytes)
  5. fillBuffer(ByteBuffer buffer, int seed)
  6. fillDdsBuffer(ByteBuffer buf)
  7. fillHlaBuffer(ByteBuffer buf)
  8. fillRange(ByteBuffer buffer, int start, int end)