반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 구글 보안 api 활용
- 쿠키의 정의
- jpa
- 필터의 정의
- application-properties
- Validation
- optional
- spring MVC
- springSecurityFilterChain 오류
- 인터셉터의 정의
- 세션vs쿠키
- MVC
- 세션의 정의
- Testcode
- 쿠키란
- 세션이란
- 김영한
- spring
- controller
- 필터vs인터셉터
- .orelseThrow
- java.lang.AssertionError
- filter vs interceptor
- BindingResult
- n+1
- abap value in field Data Class error
- 401오류
- SpringMVC
- 유연한 컨트롤러1 - v5
- @Controller
Archives
- Today
- Total
ABAP DUMP ERROR 24시
InputStream 의미 본문
반응형
정리
inputStream으로 데이터를 불러오고 StreamUtils로 해석해서 사용한다.
1. InputStream이 뭐야?
데이터를 읽어주는 메서드
= 데이터를 Byte 단위로 읽어주는 메소드
내장된 기능을 통해 읽고, 데이터의 컨텐트 타입을 가져오는 기능들을 제공
우리는 StreamUtils를 통해
StreamUtils.copyToString(inputStream, StandardCharsets.UTF_8);
btye로 읽어드린 코드들을 UTF-8 인코더를 사용해서 우리가 이해할수 있는 String으로 만들어준다.
/**
* Obtain an <code>InputStream</code> that can be used to retrieve the
* contents of the file.
*
* @return An InputStream for the contents of the file
*
* @throws IOException if an I/O occurs while obtaining the stream
*/
public InputStream getInputStream() throws IOException;
/**
* Obtain the content type passed by the browser.
*
* @return The content type passed by the browser or <code>null</code> if
* not defined.
*/
public String getContentType();
/**
* Obtain the name of the field in the multipart form corresponding to this
* part.
*
* @return The name of the field in the multipart form corresponding to this
* part.
*/
public String getName();
/**
* If this part represents an uploaded file, gets the file name submitted
* in the upload. Returns {@code null} if no file name is available or if
* this part is not a file upload.
*
* @return the submitted file name or {@code null}.
*
* @since Servlet 3.1
*/
public String getSubmittedFileName();
/**
* Obtain the size of this part.
*
* @return The size of the part if bytes
*/
public long getSize();
/**
* A convenience method to write an uploaded part to disk. The client code
* is not concerned with whether or not the part is stored in memory, or on
* disk in a temporary location. They just want to write the uploaded part
* to a file.
*
* This method is not guaranteed to succeed if called more than once for
* the same part. This allows a particular implementation to use, for
* example, file renaming, where possible, rather than copying all of the
* underlying data, thus gaining a significant performance benefit.
*
* @param fileName The location into which the uploaded part should be
* stored. Relative locations are relative to {@link
* javax.servlet.MultipartConfigElement#getLocation()}
*
* @throws IOException if an I/O occurs while attempting to write the part
*/
public void write(String fileName) throws IOException;
/**
* Deletes the underlying storage for a part, including deleting any
* associated temporary disk file. Although the container will delete this
* storage automatically this method can be used to ensure that this is done
* at an earlier time, thus preserving system resources.
* <p>
* Containers are only required to delete the associated storage when the
* Part instance is garbage collected. Apache Tomcat will delete the
* associated storage when the associated request has finished processing.
* Behaviour of other containers may be different.
*
* @throws IOException if an I/O occurs while attempting to delete the part
*/
public void delete() throws IOException;
/**
* Obtains the value of the specified part header as a String. If there are
* multiple headers with the same name, this method returns the first header
* in the part. The header name is case insensitive.
*
* @param name Header name
* @return The header value or <code>null</code> if the header is not
* present
*/
public String getHeader(String name);
/**
* Obtain all the values of the specified part header.
* @param name The name of the header of interest. The header name is case
* insensitive.
* @return All the values of the specified part header. If the part did not
* include any headers of the specified name, this method returns an
* empty Collection.
*/
public Collection<String> getHeaders(String name);
/**
* Get the header names provided for this part.
* @return a Collection of all the header names provided for this part.
*/
public Collection<String> getHeaderNames();
}
반응형
'[WEB]Back-end > Java' 카테고리의 다른 글
Optional<>()의 의미 (0) | 2022.02.24 |
---|---|
ArrayList vs HashMap ,HashMap vs HashTable, 제네릭이란? (0) | 2022.02.10 |
static, final, 필드, 메소드, 인스턴스 의미 정리 (0) | 2022.01.26 |
java 에서 this가 뭐야? (0) | 2022.01.20 |
int 와 Integer의 차이점 (0) | 2022.01.16 |
Comments