实验三:HDFS API编程基础

前提:

打开Ubuntu自带的软件商店,下载eclipse。(软件商店搜索的速度可能会比较慢,耐心等待。可以切换软件源,阿里源和清华源都可以)

评分点一:

(1)搭建HDFS API编程环境,完成测试程序并执行演示结果。

打开eclipse,左上角 file->new->java project,创建新的项目

我们设设置一个Project name和JRE即可

(这里的JRE可能因为版本不同而不同,我这里的是11)

右键我们创建的项目HDFSExample->Build Path->Configure Build Path->Java Build Path

Add External JARS

依次添加JAR包(jar包要放在classpath里)

common下的

common->lib下的所有jar包

hdfs下的

hdfs->lib下的所有jar包

编写程序

右键项目->New->class

新版的Eclipse需要设置Package名否则会报错,这里我设置成ch3,

启动dfs

测试代码

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
 

public class HDFSFileIfExist {
	public static void main(String[] args) {
		try {
			String fileName = "test";
			Configuration conf = new Configuration();
			conf.set("fs.defaultFS", "hdfs://localhost:9000");
			conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
			FileSystem hfs = FileSystem.get(conf);
			if(hfs.exists(new Path(fileName))) {
				System.out.println("文件存在");
			}else {
				System.out.println("文件不存在");
			}
		}catch (Exception e){
			e.printStackTrace();
		}
	}

}

常见问题

报错1

先确检查你是否添加对了jar包,如果是右键JRE System Library Properties

这样设置过后,run as一下,报错信息就没了,这里的报错原因应该是Eplicse不能支持较高版本的JRE

不过后面我换回来的时候又不报错了。。。

报错二:

删掉这个默认包里的文件即可

报错三:

jar包要放在classpath里!

接着我们创建一个test文件夹

再次运行代码

检测到文件存在,结束。

删除刚才创建的测试文件夹

评分点二:

(2)向HDFS中上传任意文本文件,如果指定的文件在HDFS中已经存在,则由用户来指定是追加到原有文件末尾还是覆盖原有的文件。

先创建一个测试文件,随便写点内容

新建一个class

编写代码

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

public class HDFSApi {
	/**
	* 判断路径是否存在
	*/
	public static boolean test(Configuration conf, String path) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		return fs.exists(new Path(path));
		}
	/**
	* 复制文件到指定路径
	* 若路径已存在,则进行覆盖
	*/
	public static void copyFromLocalFile(Configuration conf, String localFilePath, String remoteFilePath) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		Path localPath = new Path(localFilePath);
		Path remotePath = new Path(remoteFilePath);
		/* fs.copyFromLocalFile 第一个参数表示是否删除源文件,第二个参数表示是否覆盖 */
		fs.copyFromLocalFile(false, true, localPath, remotePath);
		fs.close();
	}
	/**
	    * 追加文件内容
	    */
	   public static void appendToFile(Configuration conf, String localFilePath,String remoteFilePath) {
	       Path remotePath = new Path(remoteFilePath);
	       try (FileSystem fs = FileSystem.get(conf);
	               FileInputStream in = new FileInputStream(localFilePath);) {
	           FSDataOutputStream out = fs.append(remotePath);
	           byte[] data = new byte[1024];
	           int read = -1;
	           while ((read = in.read(data)) > 0) {
	               out.write(data, 0, read);
	           }
	           out.close();
	       } catch (IOException e) {
	           e.printStackTrace();
	       }
	   }

	/**
	* 主函数
	*/
	public static void main(String[] args) {
	Configuration conf = new Configuration();
	conf = new Configuration();    
	conf.set("dfs.client.block.write.replace-datanode-on-failure.policy","NEVER"); 
	conf.set("dfs.client.block.write.replace-datanode-on-failure.enable","true"); 
	conf.set("fs.default.name","hdfs://localhost:9000");
	String localFilePath = "/home/yanghaijun/test.txt"; // 本地路径
	String remoteFilePath = "/user/hadoop/test.txt"; // HDFS 路径
	//String choice = "append"; // 若文件存在则追加到文件末尾
	//String choice = "overwrite"; // 若文件存在则覆盖
	try {
		/* 判断文件是否存在 */
		boolean fileExists = false;
		if (HDFSApi.test(conf, remoteFilePath)) {
			fileExists = true;
			System.out.println(remoteFilePath + " 已存在.");
		} else {
			System.out.println(remoteFilePath + " 不存在.");
		}
		/* 进行处理 */
		if (!fileExists) { // 文件不存在,则上传
			HDFSApi.copyFromLocalFile(conf, localFilePath, remoteFilePath);
			System.out.println(localFilePath + " 已上传至 " + remoteFilePath);
		} 
		else{
			Scanner sc = new Scanner(System.in);
			System.out.println("1:overwrite 2:append:");
			int num1 = sc.nextInt();
			if (num1 == 1){
				HDFSApi.copyFromLocalFile(conf, localFilePath, remoteFilePath);
				System.out.println(localFilePath + " 已覆盖 " + remoteFilePath);
			}
			else if (num1 == 2){
				HDFSApi.appendToFile(conf, localFilePath, remoteFilePath);
				System.out.println(localFilePath + " 已追加至 " + remoteFilePath);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	  }
	}
}


确认一下本地test.txt的路径的位置

运行

再运行一次,这里出现了一个报错

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

Resource specification not allowed here for source level below 1.7

和我一样做出如下修改,就是那个什么level的设置在1.7以上,这里我设成了1.8

再再次运行,控制台扣1或者扣2,扣1覆盖扣2追加,我先扣2

可以看到,HDFS上的test.txt已经被本地的test.txt追加内容

那我们再扣个1试试

可以看到,HDFS上的test.txt已经被本地的test.txt覆盖了

(3)从HDFS中下载指定文件,如果本地文件与要下载的文件名称相同,则自动对下载的文件重命名。

依然要注意路径问题哦OVO

package ch3;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;

public class HDFSReName {
	/**
	* 下载文件到本地
	* 判断本地路径是否已存在,若已存在,则自动进行重命名
	*/
	public static void copyToLocal(Configuration conf, String remoteFilePath, String localFilePath) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		Path remotePath = new Path(remoteFilePath);
		File f = new File(localFilePath);
		/* 如果文件名存在,自动重命名(在文件名后面加上 _0, _1 ...) */
		if (f.exists()) {
		System.out.println(localFilePath + " 已存在.");
		Integer i = new Integer(0);
		while (true) {
			f = new File(localFilePath + "_" + i.toString());
			if (!f.exists()) {
				localFilePath = localFilePath + "_" + i.toString();
				break;
			}
		}
		System.out.println("将重新命名为: " + localFilePath);
		}
		// 下载文件到本地
		Path localPath = new Path(localFilePath);
		fs.copyToLocalFile(remotePath, localPath);
		fs.close();
	}
	/**
	* 主函数
	*/
	public static void main(String[] args) {
		Configuration conf = new Configuration();
		conf.set("fs.default.name","hdfs://localhost:9000");
		String localFilePath = "/home/yanghaijun/test.txt"; // 本地路径
		String remoteFilePath = "/user/hadoop/test.txt"; // HDFS 路径
		try {
			HDFSReName.copyToLocal(conf, remoteFilePath, localFilePath);
			System.out.println("下载完成");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

(4)将HDFS中指定文件的内容输出到终端中。

package ch3;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;

public class HDFSOutput {
	/**
	* 读取文件内容
	*/
	public static void cat(Configuration conf, String remoteFilePath) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		Path remotePath = new Path(remoteFilePath);
		FSDataInputStream in = fs.open(remotePath);
		BufferedReader d = new BufferedReader(new InputStreamReader(in));
		String line = null;
		while ( (line = d.readLine()) != null ) {
			System.out.println(line);
		}
		d.close();
		in.close();
		fs.close();
	}
	/**
	* 主函数
	*/
	public static void main(String[] args) {
		Configuration conf = new Configuration();
		conf.set("fs.default.name","hdfs://localhost:9000");
		String remoteFilePath = "/user/hadoop/test.txt"; // HDFS 路径
		try {
			System.out.println("读取文件: " + remoteFilePath);
			HDFSOutput.cat(conf, remoteFilePath);
			System.out.println("\n 读取完成");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

(5)删除HDFS中指定的文件

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
public class HDFSDelete {
	 /**
	 * 删除文件
	 */
	 public static boolean rm(Configuration conf, String remoteFilePath) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path remotePath = new Path(remoteFilePath);
		 boolean result = fs.delete(remotePath, false);
		 fs.close();
		 return result;
	 }
	 
	 /**
	 * 主函数
	 */
	 public static void main(String[] args) {
		 Configuration conf = new Configuration();
		 conf.set("fs.default.name","hdfs://localhost:9000");
		 String remoteFilePath = "/user/hadoop/test.txt"; // HDFS 文件
		 try {
			 if ( HDFSDelete.rm(conf, remoteFilePath) ) {
				 System.out.println("文件删除: " + remoteFilePath);
			 } else {
				 System.out.println("操作失败(文件不存在或删除失败)");
			 }
			} catch (Exception e) {
				e.printStackTrace();
		}
	 } 
}

随机提问

我得到的情报是这个部分提问是在终端操作!!!(不过依然完成了API部分,只能怪实验要求模棱两可的@qinx)

终端操作

(6)显示HDFS中指定的文件的读写权限、大小、创建时间、路径等信息。

根据提供的文件路径,这是一个名为"杨海军.txt"的文件。该文件的权限为"rw-r--r--",表示文件所有者具有读写权限,而文件所有者所在的组和其他用户只有读取权限。文件大小为313字节,并且最后修改时间为2023年10月16日19:08。

 (7)给定HDFS中某一个目录,输出该目录下的所有文件的读写权限、大小、创建时间、路径等信息,如果该文件是目录,则递归输出该目录下所有文件相关信息。

 还是以 /output 为例,这里我有三个文件。


- "-ls":列出指定路径下的文件和文件夹;
- "-R":递归地列出指定路径下的所有文件和文件夹,包括子目录中的内容;
- "-h":以人类可读的格式显示文件大小,例如使用 KB、MB、GB 等。

(8)提供一个HDFS内的文件的路径,对该文件进行创建和删除操作。如果文件所在目录不存在,则自动创建目录;

先查看一下路径目录

创建目录 -p表示递归创建

删除目录

(9)提供一个HDFS的目录的路径,对该目录进行创建和删除操作。创建目录时,如果目录文件所在目录不存在,则自动创建相应目录;删除目录时,由用户指定当该目录不为空时是否还删除该目录。

(9)与(8)类似,创建部分操作一样,注意rmdir和rm的使用即可

目录里有东西时不删除,  这里提示我们目录不为空

   不管目录有没有东西一起删除

    

rmdir只能删除空目录,而rm可以删除文件和非空目录。”

(10)向HDFS中指定的文件追加内容,由用户指定内容追加到原有文件的开头或结尾

往HDFS上传文件test.txt,并创建追加文件zhuijia.txt。

追加到开头是没有直接命令的,这里的思路是:先把test下载到本地,然后上传zhuijia文件把HDFS上的test覆盖,然后再用append to file命令追加到已经被覆盖过的test上面。

下载test,这里我的文件夹里已经有test了。

用zhuijia覆盖test

接着把本地的test追加到HDFS上的test

追加到末尾

(11)删除HDFS中指定的目录,用户指定目录中存在文件时是否删除目录

命令 if then,这里的存在文件时不删除目录根据实际情况修改

(12)在HDFS中,将文件从源路径移动到目的路径

API实现

(6)显示HDFS中指定的文件的读写权限、大小、创建时间、路径等信息。

刚才的test.txt已经被删除,要重新运行HDFSApi.java生成一个test.txt!

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
import java.text.SimpleDateFormat;
public class HDFSVision {
	/**
	 ** 显示指定文件的信息
	 **/
	public static void ls(Configuration conf, String remoteFilePath) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		Path remotePath = new Path(remoteFilePath);
		FileStatus[] fileStatuses = fs.listStatus(remotePath);
		for (FileStatus s : fileStatuses) {
			System.out.println("路径: " + s.getPath().toString());
			System.out.println("权限: " + s.getPermission().toString());
			System.out.println("大小: " + s.getLen());
			/* 返回的是时间戳,转化为时间日期格式 */
			Long timeStamp = s.getModificationTime();
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String date = format.format(timeStamp); 
			System.out.println("时间: " + date);
		}
		fs.close();
	}
 
	/**
	 * 主函数
	 */
	 public static void main(String[] args) {
		 Configuration conf = new Configuration();
		 conf.set("fs.default.name","hdfs://localhost:9000");
		 String remoteFilePath = "/user/hadoop/test.txt"; // HDFS 路径
		 try {
		 System.out.println("读取文件信息: " + remoteFilePath);
		 HDFSVision.ls(conf, remoteFilePath);
		 System.out.println("\n 读取完成");
		 } catch (Exception e) {
			 e.printStackTrace();
	} } }

 (7)给定HDFS中某一个目录,输出该目录下的所有文件的读写权限、大小、创建时间、路径等信息,如果该文件是目录,则递归输出该目录下所有文件相关信息。

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
import java.text.SimpleDateFormat;
public class HDFSInformation {
	/**
	* 显示指定文件夹下所有文件的信息(递归)
	*/
	public static void lsDir(Configuration conf, String remoteDir) throws IOException {
		FileSystem fs = FileSystem.get(conf);
		Path dirPath = new Path(remoteDir);
		/* 递归获取目录下的所有文件 */
		RemoteIterator<LocatedFileStatus> remoteIterator = fs.listFiles(dirPath, true);
		/* 输出每个文件的信息 */
		while (remoteIterator.hasNext()) {
			FileStatus s = remoteIterator.next();
			System.out.println("路径: " + s.getPath().toString());
			System.out.println("权限: " + s.getPermission().toString());
			System.out.println("大小: " + s.getLen());
			/* 返回的是时间戳,转化为时间日期格式 */
			Long timeStamp = s.getModificationTime();
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String date = format.format(timeStamp); 
			System.out.println("时间: " + date);
			System.out.println();
		}
		fs.close();
	} 
 
	/**
	* 主函数
	*/
	public static void main(String[] args) {
		Configuration conf = new Configuration();
		conf.set("fs.default.name","hdfs://localhost:9000");
		String remoteDir = "/user/hadoop"; // HDFS 路径
		try {
			System.out.println("(递归)读取目录下所有文件的信息: " + remoteDir);
			HDFSInformation.lsDir(conf, remoteDir);
			System.out.println("读取完成");
		} catch (Exception e) {
		e.printStackTrace();
} } }

(8)提供一个HDFS内的文件的路径,对该文件进行创建和删除操作。如果文件所在目录不存在,则自动创建目录;

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;

public class HDFSCDdir {
	 /**
	 * 判断路径是否存在
	 */
	 public static boolean test(Configuration conf, String path) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 return fs.exists(new Path(path));
	 }
	 /**
	 * 创建目录
	 */
	 public static boolean mkdir(Configuration conf, String remoteDir) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path dirPath = new Path(remoteDir);
		 boolean result = fs.mkdirs(dirPath);
		 fs.close();
		 return result;
	 }
	 /**
	 * 创建文件
	 */
	 public static void touchz(Configuration conf, String remoteFilePath) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path remotePath = new Path(remoteFilePath);
		 FSDataOutputStream outputStream = fs.create(remotePath);
		 outputStream.close();
		 fs.close();
	 }
	 
	 /**
	 * 删除文件
	 */
	 public static boolean rm(Configuration conf, String remoteFilePath) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path remotePath = new Path(remoteFilePath);
		 boolean result = fs.delete(remotePath, false);
		 fs.close();
		 return result;
	 }
	/**
	 * 主函数
	*/
	public static void main(String[] args) {
		Configuration conf = new Configuration();
		conf.set("fs.default.name","hdfs://localhost:9000");
		String remoteFilePath = "/user/hadoop/input/test.txt"; // HDFS 路径
		String remoteDir = "/user/hadoop/input"; // HDFS 路径对应的目录
		try {
			/* 判断路径是否存在,存在则删除,否则进行创建 */
			if ( HDFSCDdir.test(conf, remoteFilePath) ) {
				HDFSCDdir.rm(conf, remoteFilePath); // 删除
				System.out.println("删除路径: " + remoteFilePath);
			} else {
				if ( !HDFSCDdir.test(conf, remoteDir) ) { 
					// 若目录不存在,则进行创建
					HDFSCDdir.mkdir(conf, remoteDir);
					System.out.println("创建文件夹: " + remoteDir);
				}
				HDFSCDdir.touchz(conf, remoteFilePath);
				System.out.println("创建路径: " + remoteFilePath);
				}
			} catch (Exception e) {
			e.printStackTrace();
} } }

(9)提供一个HDFS的目录的路径,对该目录进行创建和删除操作。创建目录时,如果目录文件所在目录不存在,则自动创建相应目录;删除目录时,由用户指定当该目录不为空时是否还删除该目录。

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;

public class HDFSCDdir2 {
	/**
	 * 判断路径是否存在
	 */
	 public static boolean test(Configuration conf, String path) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 return fs.exists(new Path(path));
	 }
	 /**
	 * 判断目录是否为空
	 * true: 空,false: 非空
	 */
	 public static boolean isDirEmpty(Configuration conf, String remoteDir) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path dirPath = new Path(remoteDir);
		 RemoteIterator<LocatedFileStatus> remoteIterator = fs.listFiles(dirPath, true);
		 return !remoteIterator.hasNext();
	 }
	 /**
	 * 创建目录
	 */
	 public static boolean mkdir(Configuration conf, String remoteDir) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path dirPath = new Path(remoteDir);
		 boolean result = fs.mkdirs(dirPath);
		 fs.close();
		 return result;
	 }
	 
	 /**
	 * 删除目录
	 */
	 public static boolean rmDir(Configuration conf, String remoteDir) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path dirPath = new Path(remoteDir);
		 /* 第二个参数表示是否递归删除所有文件 */
		 boolean result = fs.delete(dirPath, true);
		 fs.close();
		 return result;
	 }
	 
	 /**
	 * 主函数
	 */
	 public static void main(String[] args) {
		 Configuration conf = new Configuration();
		 conf.set("fs.default.name","hdfs://localhost:9000");
		 String remoteDir = "/user/hadoop/input"; // HDFS 目录
		 Boolean forceDelete = false; // 是否强制删除
		 try {
			 /* 判断目录是否存在,不存在则创建,存在则删除 */
			 if ( !HDFSCDdir2.test(conf, remoteDir) ) {
				 HDFSCDdir2.mkdir(conf, remoteDir); // 创建目录
				 System.out.println("创建目录: " + remoteDir);
			 } else {
				 if ( HDFSCDdir2.isDirEmpty(conf, remoteDir) || forceDelete ) { 
					 // 目录为空或强制删除
					 HDFSCDdir2.rmDir(conf, remoteDir);
					 System.out.println("删除目录: " + remoteDir);
				 } else { // 目录不为空
					 System.out.println("目录不为空,不删除: " + remoteDir);
				 }
				}
			} catch (Exception e) {
				e.printStackTrace();
	 } } }

(10)向HDFS中指定的文件追加内容,由用户指定内容追加到原有文件的开头或结尾

报错1:java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try.

报错2:Failed to APPEND_FILE /user/hadoop/test.txt for DFSClient_NONMAPREDUCE_-1727272013_1 on 127.0.0.1 because this file lease is currently owned by DFSClient_NONMAPREDUCE_-1859769055_1 on 127.0.0.1

在hdfs-site.xml 文件里添加下面几行代码

<property>
        <name>dfs.support.append</name>
        <value>true</value>
</property>

<property>
        <name>dfs.client.block.write.replace-datanode-on-failure.policy</name>
        <value>NEVER</value>
</property>
<property>
        <name>dfs.client.block.write.replace-datanode-on-failure.enable</name>
        <value>true</value>
</property>

(11)提供一个HDFS的目录的路径,对该目录进行创建和删除操作。创建目录时,如果目录文件所在目录不存在,则自动创建相应目录;删除目录时,由用户指定当该目录存在文件时是否还删除该目录。

先往input里传一个文件

(12)在HDFS中,将文件从源路径移动到目的路径

package ch3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
public class HDFSMove {
	 /**
	 * 移动文件
	 */
	 public static boolean mv(Configuration conf, String remoteFilePath, String 
			 remoteToFilePath) throws IOException {
		 FileSystem fs = FileSystem.get(conf);
		 Path srcPath = new Path(remoteFilePath);
		 Path dstPath = new Path(remoteToFilePath);
		 boolean result = fs.rename(srcPath, dstPath);
		 fs.close();
		 return result;
	 }
	 
	 /**
	 * 主函数
	 */
	 public static void main(String[] args) {
		 Configuration conf = new Configuration();
		 conf.set("fs.default.name","hdfs://localhost:9000");
		 String remoteFilePath = "hdfs:///user/hadoop/test.txt"; // 源文件 HDFS 路径
		 String remoteToFilePath = "hdfs:///user/hadoop/input/test.txt"; // 目的 HDFS 路径
		 try {
			 if ( HDFSMove.mv(conf, remoteFilePath, remoteToFilePath) ) {
				 System.out.println(" 将文件 " + remoteFilePath + " 移动到 " + 
				 remoteToFilePath);
			 } else {
				 System.out.println("操作失败(源文件不存在或移动失败)");
			 }
		 } catch (Exception e) {
			 e.printStackTrace();
		 } 
	}
}

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值