ch.claudio.permilena.data
Class Piece

java.lang.Object
  extended by ch.claudio.permilena.data.Piece

public class Piece
extends java.lang.Object

Version:
$Id: Piece.java 148 2006-09-14 20:52:32Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

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.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Constructor Summary
Piece(java.io.File fileArg)
          Constructor requiring a file, as a piece not associated to a file is meaningless.
 
Method Summary
 void buffer()
          Buffer a piece.
 void dropBuffer()
          Drop the buffer to free memory.
 byte[] getBuffer()
           
 java.io.File getFile()
           
 java.lang.String getName()
           
 boolean isBuffered()
           
 boolean isBuffering()
          Return true if this piece is in the process of buffering.
 int sizeNeeded()
          Determine the buffer space needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Piece

public Piece(java.io.File fileArg)
Constructor requiring a file, as a piece not associated to a file is meaningless.

Parameters:
fileArg -
Method Detail

getBuffer

public byte[] getBuffer()
Returns:
the buffer

getFile

public java.io.File getFile()
Returns:
the file

getName

public java.lang.String getName()
Returns:
the piece name

isBuffering

public boolean isBuffering()
Return true if this piece is in the process of buffering.

Returns:
if currently buffering

isBuffered

public boolean isBuffered()
Returns:
the isBuffered

sizeNeeded

public int sizeNeeded()
Determine the buffer space needed.

Returns:
the isBuffered

buffer

public void buffer()
Buffer a piece. Does not test, if it is already buffered.


dropBuffer

public void dropBuffer()
Drop the buffer to free memory.