📄 blobpageimpl.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: BLOBPageImpl.java,v 1.3 2000/10/28 16:55:16 daniela Exp $package org.ozoneDB.blob;import org.ozoneDB.*;import java.io.*;/** * One page of an ozone BLOB. * * * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.3 $Date: 2000/10/28 16:55:16 $ */public class BLOBPageImpl extends OzoneObject implements BLOBPage { byte[] data; int space; int size; public BLOBPageImpl() { } public void init( int _space ) { space = _space; data = new byte[space]; size = 0; } public int size() { return size; } /** */ public void write( byte[] b, int off ) { if (off == 0 && b.length == space) { data = b; size = space; } else { int len = b.length; // calculate the real length: 0 <= len <= (space-off) len = Math.max( Math.min( space - off, len ), 0 ); System.arraycopy( b, 0, data, off, len ); size = off + len; } } /** */ public byte[] read( int off, int len ) { // calculate the real length: 0 <= len <= (size-off) len = Math.max( Math.min( size - off, len ), 0 ); byte[] result = new byte[len]; System.arraycopy( data, off, result, 0, len ); ////////////////////////////////////////////////////// //System.out.println ("return an array with length "+result.length); return result; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -