Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

public Class UnpackedObject

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, java.util.zip.DataFormatException, .Inflater, .InflaterInputStream, .ZipException, org.eclipse.jgit.errors.CorruptObjectException, .LargeObjectException, .MissingObjectException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.AnyObjectId, .Constants, .InflaterCache, .ObjectId, .ObjectLoader, .ObjectStream, org.eclipse.jgit.util.IO, .MutableInteger, .RawParseUtils

Loose object loader. This class loads an object not stored in a pack.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static BufferedInputStream
pack-priv static void
checkValidEndOfStream(InputStream in, Inflater inf, AnyObjectId id, final byte[] buf)

pack-priv static long
pack-priv static InputStream
inflate(final InputStream in, final long size, final ObjectId id)

private static InflaterInputStream
pack-priv static boolean
isStandardFormat(byte[] hdr)

pack-priv static ObjectLoader
public static ObjectLoader

Returns:

loader to read the inflated contents.
parse
(byte[]
complete contents of the compressed object.
raw
,
AnyObjectId
expected ObjectId of the object, used only for error reporting in exceptions.
id
)

Parse an object from the unpacked object format.

pack-priv static int
readSome(InputStream in, final byte[] hdr, int off, int cnt)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BUFFER_SIZEback to summary
private static final int BUFFER_SIZE

Constructor Detail

UnpackedObjectback to summary
public UnpackedObject()

Method Detail

bufferback to summary
pack-priv static BufferedInputStream buffer(InputStream in)
checkValidEndOfStreamback to summary
pack-priv static void checkValidEndOfStream(InputStream in, Inflater inf, AnyObjectId id, final byte[] buf) throws IOException, CorruptObjectException
getSizeback to summary
pack-priv static long getSize(InputStream in, AnyObjectId id, WindowCursor wc) throws IOException
inflateback to summary
pack-priv static InputStream inflate(final InputStream in, final long size, final ObjectId id)
inflateback to summary
private static InflaterInputStream inflate(InputStream in, Inflater inf)
isStandardFormatback to summary
pack-priv static boolean isStandardFormat(byte[] hdr)
openback to summary
pack-priv static ObjectLoader open(InputStream in, File path, AnyObjectId id, WindowCursor wc) throws IOException
parseback to summary
public static ObjectLoader parse(byte[] raw, AnyObjectId id) throws IOException

Parse an object from the unpacked object format.

Parameters
raw:byte[]

complete contents of the compressed object.

id:AnyObjectId

expected ObjectId of the object, used only for error reporting in exceptions.

Returns:ObjectLoader

loader to read the inflated contents.

Exceptions
IOException:
the object cannot be parsed.
readSomeback to summary
pack-priv static int readSome(InputStream in, final byte[] hdr, int off, int cnt) throws IOException
org.eclipse.jgit.internal.storage.file back to summary

private final Class UnpackedObject.LargeObject

extends ObjectLoader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ObjectId
private final File
private final long
private final FileObjectDatabase
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
LargeObject(int type, long size, File path, AnyObjectId id, FileObjectDatabase db)

Method Summary

Modifier and TypeMethod and Description
public byte[]
getCachedBytes()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Obtain a reference to the (possibly cached) bytes of this object.

public long
getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

public int
getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

public boolean
isLarge()

Overrides org.eclipse.jgit.lib.ObjectLoader.isLarge.

Whether this object is too large to obtain as a byte array.

public ObjectStream
openStream()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Inherited from org.eclipse.jgit.lib.ObjectLoader:
copyTogetBytesgetBytesgetCachedBytes

Field Detail

idback to summary
private final ObjectId id
pathback to summary
private final File path
sizeback to summary
private final long size
sourceback to summary
private final FileObjectDatabase source
typeback to summary
private final int type

Constructor Detail

LargeObjectback to summary
pack-priv LargeObject(int type, long size, File path, AnyObjectId id, FileObjectDatabase db)

Method Detail

getCachedBytesback to summary
public byte[] getCachedBytes() throws LargeObjectException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Doc from org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Obtain a reference to the (possibly cached) bytes of this object.

This method offers direct access to the internal caches, potentially saving on data copies between the internal cache and higher level code. Callers who receive this reference must not modify its contents. Changes (if made) will affect the cache but not the repository itself.

Returns:byte[]

the cached bytes of this object. Do not modify it.

Annotations
@Override
Exceptions
LargeObjectException:
if the object won't fit into a byte array, because isLarge() returns true. Callers should use openStream() instead to access the contents.
getSizeback to summary
public long getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Doc from org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

Returns:long

size of object in bytes

Annotations
@Override
getTypeback to summary
public int getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Doc from org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

Returns:int

Git in pack object type, see org.eclipse.jgit.lib.Constants.

Annotations
@Override
isLargeback to summary
public boolean isLarge()

Overrides org.eclipse.jgit.lib.ObjectLoader.isLarge.

Doc from org.eclipse.jgit.lib.ObjectLoader.isLarge.

Whether this object is too large to obtain as a byte array.

Returns:boolean

true if this object is too large to obtain as a byte array. Objects over a certain threshold should be accessed only by their openStream() to prevent overflowing the JVM heap.

Annotations
@Override
openStreamback to summary
public ObjectStream openStream() throws MissingObjectException, IOException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Doc from org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Returns:ObjectStream

a stream of this object's data. Caller must close the stream when through with it. The returned stream is buffered with a reasonable buffer size.

Annotations
@Override
Exceptions
MissingObjectException:
the object no longer exists.
IOException:
the object store cannot be accessed.