CC-Tweaked/src/main/java/dan200/computercraft/core/filesystem/EmptyMount.java

59 lines
1.4 KiB
Java
Raw Normal View History

/*
* This file is part of ComputerCraft - http://www.computercraft.info
2019-01-01 01:10:18 +00:00
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.core.filesystem;
import dan200.computercraft.api.filesystem.FileOperationException;
import dan200.computercraft.api.filesystem.IMount;
2017-05-06 23:07:42 +00:00
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.ReadableByteChannel;
import java.util.List;
public class EmptyMount implements IMount
{
2017-05-01 14:48:44 +00:00
@Override
public boolean exists( @Nonnull String path )
2017-05-01 14:48:44 +00:00
{
return path.isEmpty();
}
2017-05-01 14:48:44 +00:00
@Override
public boolean isDirectory( @Nonnull String path )
2017-05-01 14:48:44 +00:00
{
return path.isEmpty();
}
2017-05-01 14:48:44 +00:00
@Override
public void list( @Nonnull String path, @Nonnull List<String> contents )
2017-05-01 14:48:44 +00:00
{
}
2017-05-01 14:48:44 +00:00
@Override
public long getSize( @Nonnull String path )
2017-05-01 14:48:44 +00:00
{
return 0;
}
2017-05-06 23:07:42 +00:00
@Nonnull
2017-05-01 14:48:44 +00:00
@Override
@Deprecated
2017-05-06 23:07:42 +00:00
public InputStream openForRead( @Nonnull String path ) throws IOException
2017-05-01 14:48:44 +00:00
{
throw new FileOperationException( path, "No such file" );
}
@Nonnull
@Override
@Deprecated
public ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
{
throw new FileOperationException( path, "No such file" );
2017-05-01 14:48:44 +00:00
}
}