Package org.globus.ftp

# Class Buffer

java.lang.Object
org.globus.ftp.Buffer

public class Buffer extends Object
Represents a chunk of data cut out of a larger data volume. Buffer is characterized by offset at which it belongs to the larger data volume, and length. The internal data array always starts at 0 and ends at (length -1). Its indexing has nothing to do with offset.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected byte[]`
`buf`
`protected int`
`length`
`protected long`
`offset`

## Constructor Summary

Constructors
Constructor
Description
`Buffer(byte[] buf, int length)`
`Buffer(byte[] buf, int length, long offset)`

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`getBuffer()`
`int`
`getLength()`
`long`
`getOffset()`
Returns offset of the data the buffer was read from.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### buf

protected byte[] buf

### length

protected int length

### offset

protected long offset

## Constructor Details

### Buffer

public Buffer(byte[] buf, int length)

Parameters:
  `buf` - the data buffer (always starts at 0)
  `length` - length of the data in the buffer

### Buffer

public Buffer(byte[] buf, int length, long offset)

Parameters:
  `buf` - the data buffer (always starts at 0)
  `length` - length of the data in the buffer
  `offset` - offset of the data the buffer was read from.

## Method Details

### getBuffer

public byte[] getBuffer()

### getLength

public int getLength()

### getOffset

public long getOffset()
Returns offset of the data the buffer was read from. Value -1 indicates that offset is not supported. For instance, this will happen if the buffer represents a chunk of data read off the data channel in the stream mode.