本文整理汇总了Java中com.intellij.util.ArrayUtil.EMPTY_BYTE_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.EMPTY_BYTE_ARRAY属性的具体用法?Java ArrayUtil.EMPTY_BYTE_ARRAY怎么用?Java ArrayUtil.EMPTY_BYTE_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.util.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.EMPTY_BYTE_ARRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContent
@Override
public byte[] getContent(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable SVNRevision pegRevision)
throws VcsException, FileTooBigRuntimeException {
// TODO: rewrite this to provide output as Stream
// TODO: Also implement max size constraint like in SvnKitContentClient
// NOTE: Export could not be used to get content of scheduled for deletion file
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, target.getPathOrUrlString(), pegRevision);
CommandUtil.put(parameters, revision);
CommandExecutor command = null;
try {
command = execute(myVcs, target, SvnCommandName.cat, parameters, null);
}
catch (SvnBindException e) {
// "no pristine version" error is thrown, for instance, for locally replaced files (not committed yet)
if (StringUtil.containsIgnoreCase(e.getMessage(), NO_PRISTINE_VERSION_FOR_FILE)) {
LOG.debug(e);
}
else {
throw e;
}
}
byte[] bytes = command != null ? command.getBinaryOutput().toByteArray() : ArrayUtil.EMPTY_BYTE_ARRAY;
ContentRevisionCache.checkContentsSize(target.getPathOrUrlString(), bytes.length);
return bytes;
}
示例2: getBytes
@NotNull
public byte[] getBytes() throws IOException {
if (myCachedBytes == null) {
myCachedBytes = myVirtualFile.isValid() ? myVirtualFile.contentsToByteArray(false) : ArrayUtil.EMPTY_BYTE_ARRAY;
}
return myCachedBytes;
}
示例3: contentsToByteArray
@Override
@NotNull
public byte[] contentsToByteArray() throws IOException {
if (myFileInfo == null) {
throw new UnsupportedOperationException();
}
VirtualFile localFile = myFileInfo.getLocalFile();
if (localFile != null) {
return localFile.contentsToByteArray();
}
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
示例4: gotEntry
public void gotEntry(FileObject abstractFileObject, Entry entry) {
super.gotEntry(abstractFileObject, entry);
if (entry == null) {
myState = DELETED;
myFileBytes = ArrayUtil.EMPTY_BYTE_ARRAY;
}
else {
myRevision = entry.getRevision();
myCvsRevisionNumber = new CvsRevisionNumber(myRevision);
}
}
示例5: readBytes
private byte[] readBytes(int count) throws IOException {
if (count > 0) {
byte[] bytes = new byte[count];
archive.readFully(bytes);
return bytes;
}
else {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
}
示例6: contentsToByteArray
@NotNull
@Override
public byte[] contentsToByteArray(@NotNull String relativePath) throws IOException {
FileAccessorCache.Handle<ZipFile> zipRef;
try {
zipRef = ourZipFileFileAccessorCache.get(this);
} catch (RuntimeException ex) {
final Throwable cause = ex.getCause();
if (cause instanceof IOException) throw (IOException)cause;
throw ex;
}
ZipFile zip = zipRef.get();
try {
ZipEntry entry = zip.getEntry(relativePath);
if (entry != null) {
InputStream stream = zip.getInputStream(entry);
if (stream != null) {
// ZipFile.c#Java_java_util_zip_ZipFile_read reads data in 8K (stack allocated) blocks
// no sense to create BufferedInputStream
try {
return FileUtil.loadBytes(stream, (int)entry.getSize());
}
finally {
stream.close();
}
}
}
}
finally {
zipRef.release();
}
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
示例7: contentsToByteArray
@NotNull
public byte[] contentsToByteArray() throws IOException {
if (myContentLoadFailed || myProcessingBeforeContentsChange) {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
if (myContent == null) {
loadContent();
}
return myContent;
}
示例8: loadFileBytes
private synchronized byte[] loadFileBytes() {
if (myState != LOADING) {
LOG.error("state = " + String.valueOf(myState));
}
if (myReader.isEmpty()) {
myState = DELETED;
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
else {
myState = SUCCESSFULLY_LOADED;
return myReader.getReadContent();
}
}
示例9: loadRevisionCatchingErrors
private static byte[] loadRevisionCatchingErrors(@NotNull GitFileRevision revision) throws VcsException, IOException {
try {
return revision.getContent();
} catch (VcsException e) {
String m = e.getMessage().trim();
if (m.startsWith("fatal: ambiguous argument ")
|| (m.startsWith("fatal: Path '") && m.contains("' exists on disk, but not in '"))
|| (m.contains("is in the index, but not at stage "))) {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
else {
throw e;
}
}
}
示例10: getContent
@Override
public byte[] getContent() throws IOException {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
示例11: contentsToByteArray
@NotNull
@Override
public byte[] contentsToByteArray() throws IOException {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
示例12: BinaryLightVirtualFile
public BinaryLightVirtualFile(@NonNls String name) {
this(name, ArrayUtil.EMPTY_BYTE_ARRAY);
}
示例13: setEmptyContent
public void setEmptyContent() {
myCachedBytes = ArrayUtil.EMPTY_BYTE_ARRAY;
myCachedLength = 0;
}
示例14: contentsToByteArray
@Override
@NotNull
public byte[] contentsToByteArray() throws IOException {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}
示例15: contentsToByteArray
@Override
@NotNull
public byte[] contentsToByteArray(@NotNull final VirtualFile file) throws IOException {
return ArrayUtil.EMPTY_BYTE_ARRAY;
}