Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

ByteArrayBinding.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2000-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: ByteArrayBinding.java,v 12.1 2005/01/31 19:27:29 mark Exp $
00008  */
00009 
00010 package com.sleepycat.bind;
00011 
00012 import com.sleepycat.db.DatabaseEntry;
00013 
00020 public class ByteArrayBinding implements EntryBinding {
00021 
00025     public ByteArrayBinding() {
00026     }
00027 
00028     // javadoc is inherited
00029     public Object entryToObject(DatabaseEntry entry) {
00030 
00031         byte[] bytes = new byte[entry.getSize()];
00032         System.arraycopy(entry.getData(), entry.getOffset(),
00033                          bytes, 0, bytes.length);
00034         return bytes;
00035     }
00036 
00037     // javadoc is inherited
00038     public void objectToEntry(Object object, DatabaseEntry entry) {
00039 
00040         byte[] bytes = (byte[]) object;
00041         entry.setData(bytes, 0, bytes.length);
00042     }
00043 }

Generated on Sun Dec 25 12:14:30 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2